开发者

How do I "hold" elements underneath jQuery bounce?

开发者 https://www.devze.com 2023-02-19 23:23 出处:网络
jQuery\'s effects are great, but I\'ve noticed that the remaining elements under the affected element are displaced because of the wrapping divs which cause the effect (visit this demo page and scroll

jQuery's effects are great, but I've noticed that the remaining elements under the affected element are displaced because of the wrapping divs which cause the effect (visit this demo page and scroll to "The Bouncing Effect" or "The Shake Effect" to see). 开发者_开发问答

How do I hold the rest of the elements in the document steady while the effect plays?


Okay, here's the difference: if you try to animate an element like an anchor DIRECTLY, you end up affecting other flow. If you wrap that same element in a div and animate, it's fine. Look at the difference between jsfiddle.net/ejwh4/4 and jsfiddle.net/ejwh4/5


The exemple you took is not the best. The effect only moves the element you tell it to. As you can see here the other element is not affected by the effect. However the problem that is happening in the demo you took could happen sometimes and you must be carefull. The problem could be caused by poorly positioned elements and animations. If the position of one element (A) depends on the position of an animated element (B), if B moves A will move too somehow.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号