text - Jquery slider if not working -
i trying catch if when text going left : 0px it's not working :< tip thankfully.
<script src="_js/jquery-1.12.0.min.js"></script> <script src="_js/jquery-ui.min.js"></script> <script src="_js/code.js"></script> <div class="container-for-slider"> <ul class="slides"> <li class="slide">witam na stronie głównej</li> <li class="slide">strona cały czas się rozwija</li> <li class="slide">nowe pomysły nowe możliwości</li> </ul> </div>
https://jsfiddle.net/hqp0w778/1/
setinterval(function () { $('.container-for-slider .slides').animate({'left':'-=500px'}, 5000, function () { if($('.container-for-slider .slides').position().left == '0px'){ alert('lol'); } }); }, 1000);
result of $('.container-for-slider .slides').position().left
integer. try this:
if ($('.container-for-slider .slides').position().left == 0)
i notice when testing .position().left
not return 0 ever: https://jsfiddle.net/twisty/hqp0w778/2/
$(document).ready(function() { setinterval(function() { $('.container-for-slider .slides').animate({ 'left': '-=300px' }, 5000, function() { console.log("position:", $('.container-for-slider .slides').position().left); if ($('.container-for-slider .slides').position().left === 0) { alert('lol'); } }); }, 1000); });
Comments
Post a Comment