How can I do this so that slider slides up to the "red" slide and jquery right down to the "green" slide? I think I'm missing something simple, but I'm not seeing it yet. The conduction ceremony appears to work, but the left does not right.
var slideWidth = $ ('# mySliderContainer'). Width (); Var SlideWithwidth = $ ('# mySlider'). Children () Length; Var min = 0; Var max = - (slideCountWidth -1) * Slidewid; Move the function () {$ ('# mySlider'). Animate ({left: '+ =' + slidewidth}, 400); If ($ ('$ mySlider'). Position (). Left & gt; = min) {$ ('# mySlider'). Animate ({left: '- =' + slideWidth}); }}; Function slide () {$ ('# mySlider'). Animate ({left: '- =' + SluWidth}, 400); If ($ ('$ mySlider'). Status (). Left & lt; = maximum) {$ ('# mySlider'). Animate ({left: '+ =' + slideWidth}); }};
Where jQuery is being implemented, it's located on
Ideally, if you try to go behind the minimum and maximum slides, then it should bounce back (either on the "red" or "green" slide). I am clearly doing something wrong in this bit of code.
var max = - (slideCountWidth -1) * Slidewid;
Your maximum
is correct because dragging works properly Used to be . Your problem is that you are scripting the moveRight ()
disconnect and bounce back in parallel to normal animation. This means that when you leave status (), then left and <============================= ================================================== ================================================== ================================
function slide left () {var isMin = $ ('# mySlider'). composition (). Left & gt; = Minutes; Var a = $ ('# mySlider'). Animate ({left: '+ =' + slidewidth}, 400); If (IMIN) {ANet ({left: '- =' + Slavewhite}); }}; Function Tray () {var is Max = $ ('# mySlider'). Event (). Left and lieutenant; = Max + Slide height; Var a = $ ('# mySlider'). Animate ({left: '- =' + SluWidth}, 400); If (isMax) {a.animate ({left: '+ =' + slidewidth}); }};
Comments
Post a Comment