javascript - Jquery Mobile $(document).ready(); -


i'm trying make mobile web page. page has image slider. have problem document.ready()

i have searched problem , tells me use:

$(document).bind('pageinit', function() {}); 

but think slider wants

$document.ready ( or can't run)  

the slider name bxslider (bxslider.com)

i think different solutions :

  1. disable ajax loading jquery mobile , every page reload , document ready work.

  2. change image slider.

does have suggestion?

edit : forgot add code sorry http://d.pr/n/snw7

i have had same issue jqm+bxslider, , after investigating , testing lot found solution jqm.

you have use $document.ready , $(document).on('pageshow'

take example. in example have slider called bxslider in page id "quiz":

<script>     $(document).ready(function() {         mycarousel=$('.bxslider').bxslider({             captions: false,             infiniteloop: false,             hidecontrolonend: true,             slidemargin: 10,             adaptiveheight : true         });        });      $(document).on('pageshow', '#quiz', function(){          mycarousel.reloadslider();     }); </script> 

hope helps.


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 -