Trouble with jQuery Slider -


I am getting a slider back button which is working correctly, the slider only throws the child first and it Adds to the end of your parents, nothing special. It seems that when the back button is clicked it does not fade, and until the cycle is complete, the first child is hanging, I am not sure why. I appreciate some help with this one.

jsfiddle:

  setInterval (function () {$ (slider_wrapper_id + ': first'). FadeOut ('fast', function () {$ (this). Next ('div.slide') .FadeIn (.) End (.) AppendTo (slider_wrapper_id);});}, 4000); $ ('Slider-control-forward'). ('Click', function () {$ (slider_wrapper_id + ': first') .FadeOut ('fast', function () {$ (this) .next ('Div.slide'). FadeIn (.) End () AppendTo (slider_wrapper_id);});}); $ ('Slider-control-back'). ($ {Slider_wrapper_id + ': first'}. FadeOut ('fast', function () {$ (this) .last ('Div.slide'). AppendTo (slider_wrapper_id);});});    

OK, I'm not really sure why this was so hard to think . In your forward function, you choose the next brother, who chooses the next brother. However, in your backward work you choose your element with $ (this). Av ('div.slide'). Since $ (this) has only one element in its collection, you are choosing yourself because this is because the jquery previous function does not choose the last brother, but instead you select the 'Last Matched Elements' element, To get it, you have to choose it from $ (this). siblings (). last (). The next mistake is calling the end (). AppendTo () It will take your elements out of sequence. You do not want to end () because the element you want to move is the one you have just erased (unlike the further operation where the element you want to move is the last brother you just turn Had given). Therefore, to move the element that you have folded on the front of the queue, do not use it at the end (). In your backward work, change:

  $ (this) .last ('div.slide'). FadeIn () End (). AppendTo (slider_wrapper_id); For   

:

  $ (this) .siblings (). Last (). FadeIn () PrependTo (slider_wrapper_id);   

And it will act as desired.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -