scroll - trying to get a sticky element with jquery waypoint -
so trying create sticky div either scrolls page or scrolls down page (onclick) depending on over page.
i have been tweaking code time , can't magic formula.
i using plugins from: http://imakewebthings.com/jquery-waypoints/#get-started , http://archive.plugins.jquery.com/project/scrollto
the code here.
<head> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script> <script src="http://s199881165.onlinehome.us/transfem/scripts/jquery.cookie.js"></script> <script src="http://s199881165.onlinehome.us/transfem/scripts/jquery.scrollto-1.4.3.1-min.js"></script> <script src="http://s199881165.onlinehome.us/transfem/newlayout/script/waypoints.min.js"></script> <script src="http://s199881165.onlinehome.us/transfem/newlayout/script/waypoints-sticky.min.js"></script> </head>
...
<script> $(function() { // when page has loaded, $('.tabbycat').waypoint( // create waypoint function() { $('#tabtabtab').removeclass('tabbycat', 1, 'linear'); $('#tabtabtab').addclass('stuck', 1, 'linear'); } ) }); $(function() { // when page has loaded, $('.top').waypoint( // create waypoint function() { $('#tabtabtab').removeclass('stuck', 1, 'linear'); $('#tabtabtab').addclass('tabbycat', 1, 'linear'); } ) }); var itsthis = document.getelementsbyclassname('tabbycat'); var thistoo = document.getelementsbyclassname('stuck'); $(itsthis).onclick(function(){ $(window).scrollto( {top:'1px', left:'1px'}, 300 ); }); $(thistoo).onclick(function(){ $(window).scrollto( {top:'339px', left:'1px'}, 300 ); }); </script>
tally ho!
Comments
Post a Comment