LostInQuery
LostInQuery

Reputation: 519

Removing active class and adding it to a sibling

Currently, I have a jQuery Cycle plugin that allows the image to scroll. With it's callback I am calling this function

function onAfterVideoScroll() { $('.myRemote.active').removeClass("active").next().addClass("active"); }

This SHOULD be removing the current class from another set of links, and adding the class to the it's next sibling.

This is to keep whichever image is showing it's button predecessor will be active so the user can tell which button is currently showing on the slideshow.

If this makes sense, please let me know why it will remove the active class but it never gives the sibling the active class.

Thanks!

Upvotes: 1

Views: 406

Answers (2)

LostInQuery
LostInQuery

Reputation: 519

I went ahead and removed this functionality and went a different route with the client.

I do appreciate your responses though!

Upvotes: 0

andres descalzo
andres descalzo

Reputation: 14967

to better assist you, I should have the HTML code. in principle what would I do this is to see if it works:

var xcontext = $('#myContext'); // this contains a .myRemote.active. is to reduce the search continues

function onAfterVideoScroll() {

   var xactive = $('.myRemote.active', xcontext);
   var xnext = active.next(); 

   xactive.removeClass("active");
   xnext.addClass("active"); 

}

Upvotes: 1

Related Questions