jquery - Stop moving div with page before footer -


I am using this tutorial so that my scrolls can proceed with the page, while the user scrolls. It works like a magic, but as long as you do not reach the bottom of your web and the div still has a situation and still runs from its native div to the footstep. Javascript:

  $ (document) .ready (function () {var top = $ ('# comment'). Offset () top-parseFloat ($ ('# comment'). Css ('margin hat'). (/ Auto /, 0) replace; $ (window) .scroll (function) {// the y position of scroll is var y = $ (this) .scrollTop (); / / If it is below the form then (y> = top) {// If so, add an ad to a fixed class $ ('# comment') AddClass ('fixed');} else {// otherwise Remove it $ ('#comment'). RemoveClass ('fixed');}}};});  

CSS:

  # comment Fixed {location: fixed; top: 0;}  

This is my page, so you can see what my problem is:

Sorry for my english and thanks for your reply :)

< P>

I did this after using it on css property transform . Need to calculate what you can do dynamically.

  jQuery (window) .load (function () {offset = jQuery ('fieldet'). Offset (). Top; // Left content fieldset = Offset off jQuery ('field'). External highlights (); // Exterior height of external content = jQuery ('cart-collateral'). Outer height (); // The maximum type of the right material to move outside height is maxTop = fieldset & gt; Collaterals? (Field - Colletral) + Offset: Offset; JQuery (window) .scroll (function () {st = jQuery (window) .scrollTop (); if (st & gt; offset & amp; amp; amp; & amp; amp; & amp; & amp; amp; & amp; amp; & amp; & amp; amp; & amp; & amp; amp; & amp; & amp; amp; & lt; maxTop) {jQuery ( 'Cart-colletle'). CSS ('conversion', 'translation (0px,' + (offset) + 'px'); else if (st & lt; offset) {jQuery ('cart-collet') CSS ('transform', 'transpet (0px, 0px)'; else if (st & gt; maxTop) {jQuery ('cart-colletle') .css ('conversion', 'translation (0px, '+ (Max Tech - Offset) +' PX) ');}}};});  

UPDATE

  $ (document) .ready (function () {var top = $ ('# pravyKonfig') .offset () top - parsflot ($ ('# pravyKonfig') .css ('marginopt'). Replace (/ auto /, 0)); var max = $ ('# odber'). Offset (). $ ('# PravyKonfig') Outside Heat (); $ (window) .scroll (function (evt) {var y = $ (this) .scrollTop (); $ ('# pravyKonfig'). RemoveClass ('fixed') , If (y> top & amp; amp; y & lt; max) {$ ('# pravyKonfig'). CSS ('conversion', 'translation (0px,' + (y - above) + 'Px)';) and if (y & lt; top) {$ ('# pravyKonfig'). CSS ('conversion', 'translation (0 px, 0px)'); And if (y> max) {$ ('# pravyKonfig'). CSS ('conversion', 'translation (0px,' + (max - top) + 'px)')}}};}) ;  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -