How to make the jQuery Sticky Float plug-in react dynamic page height changes?

╄→гoц情女王★ 提交于 2019-12-01 09:55:32

问题


I’m currently using StickyFloat http://plugins.jquery.com/project/stickyfloat and am dynamically changing the height of the div the object sits in via jQuery, the changing of the CSS height works perfectly, but StickyFloat doesn’t recognise the new height of the div, it keeps the original height only.

Is there any way I can kill stickly float and re-enable it again? It’s enabled with $('#floatCol').stickyfloat(); basically.
My question is identical to How to make the jQuery Sticky Float plug-in react live to page changes? and it’s doing my head in big time.


回答1:


I wrote this plugin, and in a mysterious way I see it was deleted from the jQuery repository just this month! anyway, I have a blog post with all information, and re-posted the plugin, and by now it was updated to work better, utilizing event namespacing.

Stopping an item from "floating"

It is possible to just "kill" the plugin like so:
Note, this will kill all the floating menus if you have multiple ones.

$(window).unbind('scroll.sticky')


Updated blog post

View my blogpost about this plugin which contains the links:

http://dropthebit.com/74/sticky-floating-box/

Update:

The plugin now supports sticking elements to the bottom and not only to the top



来源:https://stackoverflow.com/questions/7436804/how-to-make-the-jquery-sticky-float-plug-in-react-dynamic-page-height-changes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!