javascript - jQuery slideshow showing an empty slide on the end -


i have slideshow shows empty slide after last element, think in script, think finds 1 more child element , adds empty space, ideas? please find code attached:

$(document).ready(function() {      var ul = $('.slideshow-content').children();      var n_img = ul.children().length;      slide(ul);        function slide(ul) {          var = 1;          var x = 279;          setinterval(function() {              if (i < n_img) {                  pos = x * + "px";                  ul.animate({                      right: pos                  }, 700);                  i++;              } else {                  ul.animate({                      right: '0px'                  }, 700);                  = 1;              }          }, 3000);      }  });
<div class="slideshow-content">      <ul>          <li>              <a href="google.com" target="_blank"><img width="279" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:and9gcrtro3jzrslrrvwpbxxnznqlkax7hwaq45hezfxjxsmwgvvrifb"></a>          </li>          <li>              <img width="279" src="http://img824.imageshack.us/img824/200/open9j.jpg">          </li>          <li>              <img width="279" src="http://assets.huxley.com/engineering/about/sthree.jpg">          </li>          <li>              <img width="279" class="hippo-logo" src="http://i.imgur.com/ti0w8sv.png">          </li>          <li>              <img width="279" src="http://i.imgur.com/qsecaz4.jpg">          </li>          <li>              <img width="279" class="optile-logo" src="http://i.imgur.com/h2tf4e3.jpg">          </li>      </ul>  </div>

thanks!

try (length-1) in third line of js file.

var n_img = ul.children().length; 

hope help


Comments