jquery - How to make your div stick to the page even when resolution of the window changes -


i want div scroll down scroll window,its happening when change resolution of window position shifts

this code

$(document).ready(function() {       var stickynavtop = $('#sticker').offset().top;      var stickynav = function() {          var scrolltop = $(window).scrolltop();           if (scrolltop > stickynavtop) {                $('#sticker').addclass('effect');           } else {               $('#sticker').removeclass('effect');            }       }; });   

// in css file

.effect {     position: fixed;       width: 100%;       left: 783px;       top: 0px;   } 

basically screen resolution independent thing position fixed

if have

<div class="asd"></div> 

and want fix div css :

.asd{position:fixed; top:0;} 

in case may have forgotten . in css. "." defines class

.effect { position: fixed;       width: 100%;       left: 783px;       top: 0px;     } 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -