javascript - Scrolling a DIV container from certain point -


i need html/javascript. have div id sidemenu , it's positioned left main content, right under header (screenshot), , need div start following, when browser's top border touches div...

here mocked-up example fiddle: http://jsfiddle.net/mifi79/6bk6q/

essentially, need this:

$(document).on("scroll", function (e) {     var $body = $("body"),         $header = $("header"),         $nav = $("nav"),         $content = $(".content");     if ($(document).scrolltop() >= $header.height()) {         $nav.css({             "position": "fixed",             "top": 0         });         $content.css({             "margin-left": "27%"         });     } else {         $nav.css({             "position": "static"         });         $content.css({             "margin-left": "2%"         });     } }); 

hope gets headed in right direction.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -