D
D
Dmitry2014-04-09 14:23:33
JavaScript
Dmitry, 2014-04-09 14:23:33

What to add in the script?

There is a script slider. Spins content. 2 controls - arrows and menu items. When you click on a menu item, a class is added to it, simulating the transition to that element.

How can I use jQuery to make sure that when clicking on the arrow (left or right), the next or previous element (to which the transition occurs) is assigned the same class as when clicking directly on the menu item?
zh8n2PJ.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yuri Lobanov, 2014-04-09
@another_dream

the code.
upd:
@another_dream most likely you are reinventing the wheel. In particular, control buttons are provided there. If you still insist on changing, then you should do something like this:
When you click next, look for an element with the selectedcircle class, check if there is another element after it, if there is, then remove the selectedcircle classes from the elements and assign the class selectedcircle to the next one. Similarly for prev.
ps It's not clear why you wrote so many classes, everything could have been solved much more concisely, for example, using data-attributes.

R
riotvictim, 2014-04-09
@riotvictim

Isn't this in the basic functionality of the plugin ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question