I need some help in jquery or javascript.
I managed to do the hover effects using css and js but i can't seem to "hold" the hover effects on the default page or even after i clicked on a particular page and landed there.
Am i missing something in my css or js or both?
You can download the working files here together with the
instructions + screenshots so that you can better understand what i
am trying to describe:
https://www.dropbox.com/s/tige8a9uqay7mcj/WorkingFiles.zip?dl=0
Thanks.
Hi,
I have just made few changes only in your jquery code. myscript.js file. Pasting the code below.
$(document).ready(function(){
/*$("#contentNav1").css({
'font-weight': 'bold',
'text-decoration':
'underline'});*/
$( "#contentNav1" ).click(function() {
$( "#contentImg" ).attr( "src",
"images/boxImage1.jpg" );
$( "#contentText"
).html("contentNav Paragraph Text 1<br>contentNav Paragraph
Text 1<br>contentNav Paragraph Text 1" );
$.persistHover(this);
});
$( "#contentNav2" ).click(function() {
$( "#contentImg" ).attr( "src",
"images/boxImage2.jpg" );
$( "#contentText"
).html("contentNav Paragraph Text 2<br>contentNav Paragraph
Text 2<br>contentNav Paragraph Text 2" );
$.persistHover(this);
});
$( "#contentNav3" ).click(function() {
$( "#contentImg" ).attr( "src",
"images/boxImage3.jpg" );
$( "#contentText"
).html("contentNav Paragraph Text 3<br>contentNav Paragraph
Text 3<br>contentNav Paragraph Text 3" );
$.persistHover(this);
});
$( "#contentNav4" ).click(function() {
$( "#contentImg" ).attr( "src",
"images/boxImage4.jpg" );
$( "#contentText"
).html("contentNav Paragraph Text 4<br>contentNav Paragraph
Text 4<br>contentNav Paragraph Text 4" );
$.persistHover(this);
});
$.persistHover = function(element)
{
$(element).parent().children().css({
'font-weight': 'normal',
'text-decoration': 'none'});
$(element).css({
'font-weight': 'bold',
'text-decoration':
'underline'});
}
});
Some notes regarding the solution.
1) From your question, I understood that your hover is working fine but you want to persist the hover effects even after you click the link and un-hover.
2)Basically there is no onclick effects in css that would provide you the style changes after you click an element.
3) There is :active selector in css but it's effects will fade away after you click and leave the focus on contentNav elements.
4) I did not know whether you needed the first element "contentNav1" to be bold and underlined on page load. If you need it just uncomment the first callback function ("#contentNav1").css.
5) No changes required in CSS file.
To overcome the challenge, I created a function persistHover in jquery. It takes the element as the parameter i.e. The element in which you are calling the function.
Function works as below.
1) Remove all the effects (bold and underline) of all the children of its parent element . Here in case it will remove all effects of children (li) of its parent (ul).
2)Add bold and underline effect to the element of which onlick event the persistHover function is invoked. For example, if we call onclick of contentNav2 the element contentNav2 is passed through click event function to persisthover function and the css are applied to the element. (While the last clicked element becomes normal).


I need some help in jquery or javascript. I managed to do the hover effects using...
JAVASCRIPT/JQUERY Hello I would like some help understanding jQuery. Here are the directions: Write a program that creates the following table: Course Course Name Day Time IMS115 Windows 10 Monday 6 PM IMS215 Office 2016 Wednesday 5 PM MIS200 Java Thursday 9 AM MTH105 Business Math Saturday 10 AM Using jQuery, select every other odd row and change the font color to blue and make it bold. And here is my code: Chapter4.html <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="Chapter4.css">...
I need help with my javascript project, I've started on it but I can't seem to get ym java scripts to work with my index.html. Can someone please help me fix my code? I need the main.js & scratchpad.js to work with my index.html .Thank you Directions: Go to the following link: https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/JavaScript_basics On that page, scroll down to "A 'hello world' example". Follow the step-by-step instructions to download their code and edit it in your text editor of choice....
I'm having trouble to link the .js file to the html so changes for the html to be made in the .js file <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>:JavaScript, HTML and jQuery</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <!-- this is so I don't have to give you a separate CSS file --> <style> .hidden {display: none;} .menu { width: 100px;} </style> </head> <body> <div class="container"> <h1>Assignment 2: JavaScript, HTML and jQuery</h1> <p>To complete this...
This question was answered incorrectly. Please help. I need help using jquery to list 4 links. They should be labeled part 1 -4. When the link is clicked on, a description should appear under it about the link , followed by the link to the page. Please make all links to hw1.html and all descriptions can just say example. thank you please show output so I know it actually works
I am trying to make it so that radio buttons when clicked execute a javascript file. I have to to have the exercises in external files. Here is what I have so far. I am reusing a script that was used to make radio buttons switch CSS files so I think I have to change the set attribute options. HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <p> 4.2 Output: The first 20 Fibonacci numbers, which are...
So I need help and I have little time. I was wondering if
someone can help me out. its due in a few hours and I have been
trying to catch up because of persoanl reasons.
https://www.dropbox.com/s/95w9wqkova5i8zy/New%20folder.zip?dl=0
those are the folder files, I am bit still behind on
Bootstrap.
of these SDS for t date. Diss payablo be IO With Its Positions abso, Width ean ute Positions abs a te Wich1 se FIGURE S.39 Completed project 2 PROJECT 3 Art...
Assignment:Super Lotto
This exercise is JavaScript only. No jQuery, please. Your page
should work as follows:
Ask the user the highest number that they want to generate. (Some
lotteries are 1 ‐ 47, some 1 ‐ 49, etc.)
Ask the user how many numbers they want to generate.
Create a function that returns a random number between 1 and the
highest number (see "Additional Info" below).
Create an array of numbers. Run the function the correct number
of times, putting...
// I need help in creating and publishing a website with two pages for this assignment, I am new to this and need a bit of help as to what and how many HTML files I need to create, and CSS files. If anyone could send me a sample code or anything to start out with it would be appreciated ! I have attached the specifications and requirements below CPI 101 Introduction to Informatics Homework #1 Check Out My Website!...
I am writing an html site and need help with dropdown navigation bars. The navigation bar should have dropdown menus to navigate around the site to different pages. The issue is that it cannot use div elements and while it can use javascript it would be highly preferred it did not. The home page is in its own directory as well as the css has its own directory and the web pages have their own directory. The navigation bar should...
I need some help< I keep getting this wrong and don’t understand why 2. 5. Challenge Children files Let’s test your file creation skills. Make sure you are on the ~/workspace directory and: 1.Create the following files. Try creating them directly from the ~/workspace directory, all at once: test-website/index.html test-website/.website-config test-website/css/styles.css test-website/img/logo.png test-website/js/scripts.js 2.From your ~/workspace directory, list the test-website/css directory content including hidden files 3.Clear the terminal screen Once you have completed these tasks press the Check It button...