本文实例讲述了jQuery实现的简单悬浮层功能。分享给大家供大家参考,具体如下:
运行效果图如下:
具体代码如下:
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "TR/xhtml1/DTD/xhtml1-transitional.dtd" html xmlns="1999/xhtml" head meta http-equiv="Content-Type" content="text/html; charset=utf-8" / title Test /title script type="text/javascript" language="javascript" src="jquery-1.7.2.min.js" /script script type="text/javascript" language="javascript" $(function() { var timer, scrollTop, sideDiv = $('#fudong').appendTo('body'); $(window).scroll(function() { timer clearTimeout(timer); scrollTop = $(this).scrollTop(); timer = setTimeout(function() { sideDiv.animate({ top: scrollTop + 100 + 'px' }, 600); }, 200); /script /head body div id="fudong" 右侧悬浮层 /div /body /html
更多关于jQuery相关内容感兴趣的读者可查看本站专题:《》、《》、《》、《》、《》、《》、《》及《》
希望本文所述对大家jQuery程序设计有所帮助。