最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

jquery实现的一个导航滚动效果具体代码_jquery

来源:动视网 责编:小采 时间:2020-11-27 21:09:55
文档

jquery实现的一个导航滚动效果具体代码_jquery

jquery实现的一个导航滚动效果具体代码_jquery:在做校园网视频网站的时候,首页有一个导航页面要实现滚动效果,有样例,但代码是在难弄懂,貌似网页设计这块还是只有自己的代码自己懂,索性就仿造别人的效果自己做了一个,大体上还行,看起来还是比较流畅的,不次于原作的幺。 现在先把代码拷贝到这里,以
推荐度:
导读jquery实现的一个导航滚动效果具体代码_jquery:在做校园网视频网站的时候,首页有一个导航页面要实现滚动效果,有样例,但代码是在难弄懂,貌似网页设计这块还是只有自己的代码自己懂,索性就仿造别人的效果自己做了一个,大体上还行,看起来还是比较流畅的,不次于原作的幺。 现在先把代码拷贝到这里,以
 在做校园网视频网站的时候,首页有一个导航页面要实现滚动效果,有样例,但代码是在难弄懂,貌似网页设计这块还是只有自己的代码自己懂,索性就仿造别人的效果自己做了一个,大体上还行,看起来还是比较流畅的,不次于原作的幺。

现在先把代码拷贝到这里,以后再逐一简化修改:
实现滚动效果,脚本代码如下:
代码如下:
var all=0;
var no=0;
var s_width=0;
$(document).ready(function(){
all=$('.slide').length;
s_width=$('.slide').eq(0).width();
$("#slides").css('width',all*s_width);
var contiar=$('.control_links');
for(var i=0;icontiar.append("

  • ");
    }
    $('.control_links li').bind('click mouseenter',function(){
    var index=$(this).index();
    no=index;
    var no_= no%all;
    $("#slides").animate({left:(-1*no_*s_width)+'px'},200);
    $(this).css('background-color','#fff');
    $(this).siblings().css('background-color','#333');
    });
    setInterval(function(){
    var no_= no%all;
    $("#slides").animate({left:(-1*no_*s_width)+'px'},1000);
    var curr= $('.control_links li').eq(no_);
    curr.css('background-color','#fff')
    curr.siblings().css('background-color','#333');
    no++;
    },5000);
    });

    css 代码如下:
    代码如下:
    img{
    border:none;
    }
    #daohangpic {
    width:1000px;
    margin:0 auto;
    padding:20px;
    overflow:hidden;
    }
    #daohangpic img {
    height:380px;
    width:980px;
    }

    #contiar {
    position:relative;
    width:980px;
    height:380px;
    overflow:hidden;
    margin:0 auto;
    }
    #slides {
    position:absolute;
    border:none;
    }
    .slide {
    float:left;
    width:980px;
    height:380px;
    overflow:hidden;
    border:none;
    }
    .control_links{
    position:absolute;
    bottom:10px;
    right:10px;
    z-index:200;
    }
    .control_links,.control_links li {
    list-style: none;
    }
    .control_links li {
    float:left;
    width: 15px;
    height: 15px;
    margin-right: 5px;
    text-align: center;
    background:#333;
    border: 1px solid #666;
    cursor: pointer;
    opacity:0.5;
    }
    .caption {
    position:absolute;
    height:50px;
    width:100%;
    background-color:#000;
    bottom:0px;
    padding-left:20px;
    padding-top:10px;
    overflow:hidden;
    z-index:100;
    background:url(hdpng.png) no-repeat scroll 0 -1px;
    }
    .caption h2 {
    color: #FFF;
    font-size: 17px;
    font-weight: bold;
    line-height:25px;
    }
    .caption p{
    display: block;
    color: #767676;
    font-size:12px;
    line-height:15px;
    }

    要实现滚动的区域定义如下:
    代码如下:





    格莱美获奖名单揭


    格莱美获奖名单揭晓,众大腕颁奖礼现场飙歌






    格莱美获奖名单揭


    格莱美获奖名单揭晓,众大腕颁奖礼现场飙歌






    格莱美获奖名单揭


    格莱美获奖名单揭晓,众大腕颁奖礼现场飙歌






    格莱美获奖名单揭


    格莱美获奖名单揭晓,众大腕颁奖礼现场飙歌


    场?



    格莱美获奖名单揭


    格莱美获奖名单揭晓,众大腕颁奖礼现场飙歌










    文档

    jquery实现的一个导航滚动效果具体代码_jquery

    jquery实现的一个导航滚动效果具体代码_jquery:在做校园网视频网站的时候,首页有一个导航页面要实现滚动效果,有样例,但代码是在难弄懂,貌似网页设计这块还是只有自己的代码自己懂,索性就仿造别人的效果自己做了一个,大体上还行,看起来还是比较流畅的,不次于原作的幺。 现在先把代码拷贝到这里,以
    推荐度:
    标签: 有一个 导航 滚动
    • 热门焦点

    最新推荐

    猜你喜欢

    热门推荐

    专题
    Top