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

mysql - java.sql.SQLException Parameter index out of range (1 > number of parameters, which is 0) -

c - ALSA programming: how to stop immediately -