stellar.js - stellar js initialise with jquery only -


stellar js requires following data attribute element like:

    <div data-stellar-ratio="2"></div> 

however cannot use inline html on particular site i'd need use jquery.

i tried add data attribute jquery not seem work. have idea why?

    $(window).stellar();      $('.gallery.home .image:nth-child(2)').data('stellar-ratio', '2'); 

you need order stellar() method :

$('.gallery.home .image:nth-child(2)').data('stellar-ratio', '2'); $(window).stellar(); //after data-attribute set... 

Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -