js页面滚动浮动层智能定位(jQuery)实现
2013-03-25 16:17
796 查看
如有不明白的地方欢迎加QQ群14670545 探讨
///js页面滚动浮动层智能定位(jQuery)实现 ///调用:$("#popfloat").smartFloat($("#mainInfo").width() + 21); $.fn.smartFloat = function(width_p) { var position = function(element) { var top = element.position().top, pos = element.css("position"); $(window).scroll(function() { var scrolls = $(this).scrollTop(); if (scrolls > top) { if (window.XMLHttpRequest) { element.css({ position: "fixed", width: width_p, top: 0 }); } else { element.css({ top: scrolls }); } } else { element.css({ position: "", //absolute top: top }); } }); }; return $(this).each(function() { position($(this)); }); };
相关文章推荐
- js页面滚动时层智能浮动定位实现(jQuery)
- js页面滚动时层智能浮动定位实现(jQuery/MooTools)
- js页面滚动时层智能浮动定位实现(jQuery/MooTools)
- js页面滚动时层智能浮动定位实现
- js页面滚动浮动层智能定位(jQuery)实例页面
- jQuery实现页面滚动时层智能浮动定位实例探讨
- jQuery实现页面滚动时层智能浮动定位
- jQuery实现页面滚动时层智能浮动定位
- js页面滚动时层智能浮动定位实现
- jquery实现页面滚动时层智能浮动定位
- 页面滚动时层智能浮动定位,jQuery/MooTools实现
- js页面滚动时层智能浮动定位实现
- jQuery实现页面滚动时智能浮动定位
- js页面滚动浮动层智能定位(jQuery)实例页面
- jQuery实现页面滚动时层智能浮动定位
- 【代码片段】jQuery实现页面滚动时层智能浮动定位-Fixed Floating Elements
- jQuery实现页面滚动时层智能浮动定位
- jQuery实现页面滚动时元素智能定位