相思资源网 Design By www.200059.com

本文实例讲述了jQuery实现指定内容滚动同时左侧或其它地方不滚动的方法。分享给大家供大家参考。具体如下:

本效果可实现左上角Logo的置顶但不滚动,而文字也就是网页主体区滚动,当用户拖动滚动条的时候可看到此效果,例子挺简单。

先看一下运行效果截图:

jQuery实现指定内容滚动同时左侧或其它地方不滚动的方法

具体代码如下:

<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery跟随滚动的侧边条效果</title>
<style>
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video{margin: 0;padding: 0;border: 0;font-size: 100%;font: inherit;vertical-align: baseline;}
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section{display: block;}
body{line-height: 1;}
ol, ul{list-style: none;}
blockquote, q{quotes: none;}
blockquote: before, blockquote: after,
q: before, q: after{content: '';content: none;}
table{border-collapse: collapse;border-spacing: 0;}
a{text-decoration: none;}
body{background: url("//img.jbzj.com/file_images/article/201508/201588101650294.jpg") repeat scroll 0 0 transparent;font: 12px/20px "Helvetica Neue",Helvetica,Arial,sans-serif;}
p{line-height: 24px;margin: 0 0 15px 0;color: #fff;}
.header{color: #FFFFFF;font-size: 15em;height: 150px;letter-spacing: -10px;margin: 20px auto;clear: both;text-align: center;font-family: Georgia, "Times New Roman", Times, serif;}
.italic{font-style: italic;}
#sticky{margin-top: 50px;margin-left: 50px;padding: 5px;background: rgba(255,255,255,1);height: 120px;width: 305px;-webkit-border-radius: 7px;-moz-border-radius: 7px;border-radius: 7px;}
#sticky: hover{background: #6c6c6c;background: rgba(54,54,54,0.80);}
.sticky_text{color: #ffffff;text-align: center;font-size: 16px;line-height: 20px;padding-top: 10px;}
#text, h1{color: #fff;margin: 0 auto;font-size: 1.2em;line-height: 23px;width: 500px;}
h1,h2{font-weight: bold;line-height: 50px;}
a{color: #e3e3e3;}
a: hover{color: #ccc;}
#container{width: 744px;}
.menu{float: left;}
.button{-moz-box-shadow: inset 0px 1px 0px 0px #ffffff;-webkit-box-shadow: inset 0px 1px 0px 0px #ffffff;box-shadow: inset 0px 1px 0px 0px #ffffff;background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf) );background: -moz-linear-gradient( center top, #ededed 5%, #dfdfdf 100% );filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf');background-color: #ededed;-moz-border-radius: 6px;-webkit-border-radius: 6px;border-radius: 6px;border: 1px solid #dcdcdc;display: inline-block;color: #777777;font-family: arial;font-size: 15px;font-weight: bold;padding: 6px 24px;text-decoration: none;text-shadow: 1px 1px 0px #ffffff;cursor: pointer;margin-top: 10px;}
.button: hover{background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #cfcfc) );background: -moz-linear-gradient( center top, #ededed 5%, #cfcfcf 100% );filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#cfcfcf');background-color: #ededed;border: 1px solid #bbbbbb;}
.button: active{background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #dfdfdf), color-stop(1, #ededed) );background: -moz-linear-gradient( center top, #dfdfdf 5%, #ededed 100% );filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#dfdfdf', endColorstr='#ededed');background-color: #dfdfdf;}
#download{margin-top: 50px;width: 400px;height: 100px;font-size: 72px;line-height: 100px;margin-right: 100px;margin-bottom: 50px;text-align: center;}
</style>
<script src="/UploadFiles/2021-04-02/jquery-1.6.2.min.js">

希望本文所述对大家的jquery程序设计有所帮助。

标签:
jQuery,指定内容,滚动,不滚动

相思资源网 Design By www.200059.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
相思资源网 Design By www.200059.com

评论“jQuery实现指定内容滚动同时左侧或其它地方不滚动的方法”

暂无jQuery实现指定内容滚动同时左侧或其它地方不滚动的方法的评论...

《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线

暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。

艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。

《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。