html - jQuery code not showing up -


i don't have experience jquery trying implement image slider website. read instructions , believe implemented when navigate page test it, there's nothing there. if jquery doesn't work, shouldn't div showing up, @ least? don't understand what's going wrong. can please see code , let me know if there's mistake? not including surrounding code because have several external stylesheets pain copy/paste. however, if necessary, tackle later.

 <script src="jquery-1.10.2.js"></script>  <script src="ion/js/ion-imageslider/ion.imageslider.js"></script>  <script>  $("#myslider").ionimageslider();  </script>  <div class="ion-image-slider" id="myslider">  <a href="http://farm5.staticflickr.com/4102/4911060184_6f78a83288.jpg"><img src="http://farm5.staticflickr.com/4102/4911060184_6f78a83288.jpg" data-caption="shakespeare house" /></a>  <a href="http://farm5.staticflickr.com/4096/4925016771_3bac794a81.jpg"><img src="http://farm5.staticflickr.com/4096/4925016771_3bac794a81.jpg" data-caption="old site" /></a>  <a href="http://farm5.staticflickr.com/4119/4911067626_a52a6ca492.jpg"><img src="http://farm5.staticflickr.com/4119/4911067626_a52a6ca492.jpg" data-caption="gymga" /></a>  </div> 

thanks in advance!

you trying access element not yet added dom use document.ready ensure elements added dom before access it.

$(document).ready(function(){      $("#myslider").ionimageslider(); }); 

while javascript provides load event executing code when page rendered, event not triggered until assets such images have been received. in cases, script can run dom hierarchy has been constructed. handler passed .ready() guaranteed executed after dom ready, best place attach other event handlers , run other jquery code. when using scripts rely on value of css style properties, it's important reference external stylesheets or embed style elements before referencing scripts, jquery api.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -