六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 402|回复: 0

jquery浮动层,跳转到页面指定链接。

[复制链接]

升级  0%

12

主题

12

主题

12

主题

秀才

Rank: 2

积分
50
 楼主| 发表于 2013-2-8 01:03:54 | 显示全部楼层 |阅读模式
修改一下JQUERY的引用位置,就可以使用了。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head><title>浮动广告</title><style type="text/css">#qqonline1{background-color:#fff;border: 1px solid #ccc;position:absolute;top:100px;right:16px;width:100px;padding:10px 20px;}</style><script src="jquery-1.3.2.min.js" type="text/javascript"></script><script type="text/javascript">$(this).scroll(function() { // 页面发生scroll事件时触发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;}$("#qqonline1").css("top", 100 + bodyTop)});function jump(id){$(id).scrollTop(0); return false;}</script></head><body><!-- 给BODY加个样式,让页面出现滚动条 --><div id="arc1" style="height:1000px;"><h3>arc1</h3></div><form id="form1" runat="server"></form><div id="arc2" style="height:1000px;"><h3>arc2</h3></div><div id="arc3" style="height:1000px;"><h3>arc3</h3></div><div id="qqonline1"><a href="#arc1">ARTICLE1</a><a href="#arc2">ARTICLE2</a><a href="#arc3">ARTICLE3</a></div></body></html>
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表