LiranCohen / stickUp

stickUp a jQuery Plugin for sticky navigation menus.
GNU Lesser General Public License v3.0
1.54k stars 617 forks source link

how stop fixed element at a certain point? #51

Open Milad-jfr opened 8 years ago

Milad-jfr commented 8 years ago

I want to stop sticky element at a certain Element. when user scroll the page down the element stop from scrolling on #footer. how can i do that ?

gaoxiang9457 commented 8 years ago

1.replace \stickUp-master\example\js\stickUp.js, 2.modify \stickUp-master\example\index.html   1)   2) topMargin: 'auto' ,footer: '#footer'

stickUp.js.zip

Milad-jfr commented 8 years ago

thanks its worked but the sticky element dissapier suddenly before footer comes and its not so nice and smooth. i want it to stop just before footer on its position and then start again on top side scrolling .

gaoxiang9457 commented 8 years ago

modify stickUp.js at last few lines:

image

        if((varscroll + topMargin < vartop)||(varscroll + topMargin+ winHeight>varbottom)){
            $('.stuckMenu').css("top",(varbottom-varscroll - topMargin- winHeight)+"px");
        };
Milad-jfr commented 8 years ago

thanks to Following up this topic. i replaced this code : if((varscroll + topMargin < vartop)||(varscroll + topMargin+ winHeight>varbottom)){ $('.stuckMenu').css("top",(varbottom-varscroll - topMargin- winHeight)+"px"); }; with all this lines : if((varscroll + topMargin < vartop)||(varscroll + topMargin+ winHeight>varbottom)){ $('.stuckMenu').removeClass('isStuck'); $('.stuckMenu').next().closest('div').css({ 'margin-top': currentMarginT + 'px'}, 10); $('.stuckMenu').css("position","relative"); }; now its works well in the bottom and its stop smoothly `before the footer but now the sticky element dissapier on the top of page !

gaoxiang9457 commented 8 years ago

sorry,i can't fully understand what you say:[but now the sticky element dissapier on the top of page !] would show me what you want on a picture? or mail to 632119457@qq.com