Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Any way to stop the “skip up”?? Re: Any way to stop the “skip up”??

#64238
Rob MacKay
Participant

quick rundown:

starts with watching the links in the div.infobutton (that might have to be #infobutton – I think it was an ID can’t remember lol).

live is just something I love these days, basically it enables content to work even if it has changed on the page. Sometimes if a link is added or something changes it won’t work as an interactive item because of the way the jQuery loads (best to have a look at the live() help)

Then we make a variable that has the current clicked a’s class, so we know which a has been clicked.

next we need to find where the boxes are, then use .find() to find the box with the class ‘open’, the open class flags which box is open. We then fade this box out, because it’s not the one we want and remove the class, because it’s not open anymore. Then we find the box with the class that matches the link, fade it in and give it the class open.

Then the next link you click will do the whole find the open box first and close it, then open the clicked one – and add a class of open :)

useful links:

http://api.jquery.com/live/
http://api.jquery.com/find/
http://api.jquery.com/addClass/
http://api.jquery.com/removeClass/