• 手机版

    扫码体验手机版

  • 微信公众号

    扫码关注公众号

国内首家协议开发

软芯音视解码保护平台

在线
客服

发布
需求

在线
聊天

天盟
APP

天盟APP下载

关注
微信

微信扫一扫访问
顶部

点击菜单无法切换图片

作业




















































css部分:

*{

margin: 0;

padding: 0;

}

li{

list-style-type: none;

}

body{

font-family: "微软雅黑";

color: #14191e;

}

a:link,a:visited{

text-decoration: none;

color: #333;

}

/*整体页面*/

.main{

width: 1200px;

height: 520px;

margin: 20px auto;

}

/*导航*/

.menu{

width: 1200px;

height: 60px;

}

ul{

width: 1200px;

height: 60px;

}

.inner{

width: 300px;

height: 60px;

font-size: 20px;

line-height: 60px;

text-align: center;

float: left;

}

.active{

background-color:#ffcc00;

}

/*banner图*/

.banner{

width: 1200px;

height: 460px;

position: relative;

}

.bannre-slide{

width: 100%;

height: 100%;

position: absolute;

top: 0;

left: 0;

display: none;

}

.banner-active{

display: block;

}

js部分:

//封装代替getElementById()的方法

function byId(id){

  if(typeof(id)==="string"){

    return document.getElementById(id);

  }

  else{

    return id;

  }

}

//全局变量

var index=0,

    timer=null,

    pits=byId("banner").getElementsByTagName("img"),

    dots=byId("menu").getElementsByTagName("li"),

    len=pits.length;



function slideImg(){

  var main=byId("main");

  //鼠标悬停整个main区域时,清除定时器

  main.onmouseover=function(){

    if(timer){

      clearInterval(timer);

    }

  }

  //鼠标离开启动定时器

  main.onmouseout=function(){

    timer=setInterval(function(){

        index++;

        if(index>=len){

          index=0;

        }

        changeImg();



    },2000)

  }

  main.onmouseout();

  //绑定点击事件

  for(var d=0;d

免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。

版权声明:作者保留权利,不代表天盟立场。

使用道具 举报

全部参与1

a标签的href表示跳转,如果为空的话在点击时会刷新页面表示跳转到原页面了,刷新的时候你原来的事件也被清除了,如果a标签只是使用不进行跳转的话,这样写首页,把所有的a标签的href里面写上javascript:;就可以了

使用道具 举报

发新帖

发布任务需求已有1031167位用户正在使用天盟网服务

发布分类: *
任务预算: *
需求内容: *
手机号码: *
任务商家报价为
  • 预算价 :
  • 成交价 :
  • 完工期 :
  • 质保期 :

* 最终任务项目以服务商报价、双方协商为准!