javascript - waypoint Plugin Jquery -


this question exact duplicate of:

$(function() {      // our dom lookups beforehand     var nav_container = $(".nav-container");     var nav = $("nav");      nav_container.waypoint({         handler: function(event, direction) {             nav.toggleclass('sticky', direction=='down');              if (direction == 'down') nav_container.css({ 'height':nav.outerheight() });             else nav_container.css({ 'height':'auto' });         },         offset: 15     });  }); 

how you? - i'm using imakewebthings.com/jquery-waypoints move nav element down page. how ever un-stick nav element @ specific segment of page , when scrolling stick , carry original spot- maybe 30pixcel after scrolling down.

any appreciated.

if understand you're wanting element stick when passes threshold, , return fixed when goes above that?

if - check out http://drewdahlman.github.io/pinned/ you're wanting. it's easy use plugin.

$("#element").pinned({     bounds: 30, // when become sticky     scrolling: 0, // position during scroll  }); 

it return original position after it's above 30 , stick when hits 30px. make sure set it's default position absolute.

good luck!


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -