Thursday, 15 September 2011

javascript - add class to next element jquery click function -


I have created a vertical slider and I want the classes click on the next device (next) and click on the last click

This is my code and

  $ (".bxslider-internal: nth-child (4n + 1)"). AddClass ('noBlur'); $ (". BxSlider-Inner: nth child (4n + 2)") addClass ('Blur1') ;. $ (". BxSlider-Inner: nth child (4n + 3)") addClass ('Blur2') ;. $ ("BxSlider- Inner: nth child (4n).") AddClass ('Blur3') ;. Click $ ("A.bx-next") (function () {$ ("Bxslider-inner: nth-child (4n + 1)"). Next (). AddClass ('noBlur'); $ (" .bxslider-inner: nth-child (4n + 2) "). Next () AddClass ('Blur1'); $ (" .xxlider-inner: nth-child (4n + 3) "). Next () AddClass ('Blur2'); $ (".bxslider- Internal: nth-child (4n)"). Next (). AddClass ('Blur3');}); $ ("A.bx-prev") (function () {$ (". Bxslider-inner: nth-child (4n + 1)"). Previous (). AddClass ('noBlur'); $ (" .bxslider-inner: nth-child (4n + 2) "). Former (). AddClass ('Blur1'); $ (" .bxslider- Internal: nth-child (4n + 3) "). AddClass ('Blur2'); $ (".bxslider-inner: nth-child (4n)"). Previous (). AddClass ('Blur3');});  

Classes begin to collide with each other by adding 'squared' squares First, I suggest clearing the existing classes, eg :

  $ ("bxslider-inner: nth-child (4n + 1)"). Next (). RemoveClass () AddClass ('bxslider-inward') AddClass ('noBlur');  

etc. The problem is that he only clicks the button first, as

  $ (".bxslider-inner: nth -child (4n + 1) "). The next ()  

will always be the same element. Now you need to find a way to get the right elements on your click function.

Here are some elements:


No comments:

Post a Comment