分享在线客服浮动效果。代码如下:
<!doctype html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>在线客服浮动</title> <style type="text/css"> <!-- #qqonline { background-color:Yellow; border: 1px solid #fcc; position:absolute; top:250px; left:18px; width:200px; height:120px; } --> </style> <script type="text/javascript" src="/demo/js/jq.js"></script> <script type="text/javascript"> $().ready(function(){ $(window).scroll(function() { window.setTimeout(function(){ var bodyTop = 0; if (typeof window.pageYOffset != 'undefined') { bodyTop = window.pageYOffset; } else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') { bodyTop = document.documentElement.scrollTop; } else if (typeof document.body != 'undefined') { bodyTop = document.body.scrollTop; } $("#qqonline").css("top", 100 + bodyTop) $("#qqonline").text(bodyTop); },300) }) }); </script> </head> <body style="height:1800px"> <div id="qqonline"> QQ在线服务 </div> </body> </html>
网友评论文明上网理性发言 已有0人参与
发表评论: