zoukankan      html  css  js  c++  java
  • 幻灯片slider

    <script src="{$GetInstallDir}web/scripts/jquery-1.3.1.js"></script>


    <style> /*环保首页幻灯*/ .left_hd {980px; height: 240px; overflow:hidden;position: relative;} ul.list_img {position: absolute; 3000px;} ul ,li {list-style: none;} .list_img li { 980px;font-size: 30px;height: 240px;/*~~如果横向切换设置float:left;~~*/} .list_num { position: absolute; right: 0px; bottom: 0px;} .list_num li {float: left; 20px; height: 20px; background: #eaeaea; list-style: none; text-align: center; cursor: pointer;margin: 2px;} .list_num li.on {background: #FF0000;} </style> <script> // 首页幻灯 function slideshow(){ var index = 0; var len = $(".list_img li").length; //自动翻转 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ var MyTime = setInterval(function(){ showimg(index); index++; if(index==len){index=0;} },3000); //数字跳转 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ $(".list_num li").mouseover(function(){ index = $(".list_num li").index(this); showimg(index); }); //鼠标悬停是不翻转 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ $('.left_hd').hover(function(){ if(MyTime){ clearInterval(MyTime); } },function(){ MyTime = setInterval(function(){ showimg(index) index++; if(index==len){index=0;} } , 4000); }); } //翻转效果函数,stop用来解决鼠标滑动过快后多次执行的bug ~~~~~~~~~~~~~~~~~~~~~~~~~~~ function showimg(i){ //渐变切换 $(".list_img li").eq(i).stop(true,true).fadeIn("slow").siblings("li").hide(); //横向切换 //$(".list_img").stop(true,false).animate({left:-500*i},200); //竖向切换 //$(".list_img").stop(true,false).animate({top:-200*i},200); $(".list_num li").eq(i).addClass("on").siblings().removeClass("on"); } // $(document).ready(function() { slideshow(); $("#focus_hd a:first").css('display', 'block'); }); </script> <div class="left_hd" id="focus_hd"> <div style=" 980px; height: 240px; position: relative;" class="focus_wrap list_img"> <li> <a target="_blank" href="" title=""> <img width="980" height="240" src="{$GetInstallDir}web/img/s2.jpg"> </a> </li> <li> <a target="_blank" href="" title=""> <img width="980" height="240" src="{$GetInstallDir}web/img/s4.jpg"> </a> </li> <li> <a target="_blank" href="" title=""> <img width="980" height="240" src="{$GetInstallDir}web/img/s3.jpg"> </a> </li> </div> <div class="focus_page list_num"> <li class="on">1</li> <li class="">2</li> <li class="">3</li> </div> </div>
    <style>
    /*首页幻灯*/
    .left_hd {960px; height: 240px; overflow:hidden;position: relative;}
    ul.list_img {position: absolute;  3000px;}
    ul ,li {list-style: none;}
    .list_img li { 960px;font-size: 30px;height: 240px;/*~~如果横向切换设置float:left;~~*/}
    .list_num { position: absolute; right: 0px; bottom: 0px;}
    .list_num li {float: left;  20px; height: 20px; background: #eaeaea; list-style: none; text-align: center; cursor: pointer;margin: 2px;}
    .list_num li.on {background: #FF0000;}
    </style>
    <script>
    
    // 首页幻灯
    function slideshow(){
      var index = 0;
      var len = $(".list_img li").length;
      //自动翻转 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
      var MyTime = setInterval(function(){
      showimg(index);
      index++;
      if(index==len){index=0;}
      },3000);
      //数字跳转 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
      $(".list_num li").mouseover(function(){
      index = $(".list_num li").index(this);
      showimg(index);
      });
      //鼠标悬停是不翻转 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
      $('.left_hd').hover(function(){
      if(MyTime){
      clearInterval(MyTime);
      }
      },function(){
      MyTime = setInterval(function(){
      showimg(index)
      index++;
      if(index==len){index=0;}
      } , 4000);
      });
    }
    //翻转效果函数,stop用来解决鼠标滑动过快后多次执行的bug ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    function showimg(i){
      //渐变切换
      $(".list_img li").eq(i).stop(true,true).fadeIn("slow").siblings("li").hide();
      //横向切换
      //$(".list_img").stop(true,false).animate({left:-500*i},200);
      //竖向切换
      //$(".list_img").stop(true,false).animate({top:-200*i},200);
      $(".list_num li").eq(i).addClass("on").siblings().removeClass("on");
    }
    //
     $(document).ready(function() {
    slideshow(); 
            $("#focus_hd a:first").css('display', 'block');
          }); 
    </script>
    
        <div class="left_hd" id="focus_hd">
            <div style=" 960px; height: 240px; position: relative;" class="focus_wrap list_img">
                   <li>
                      <a target="_blank" href="" title="">
                        <img width="960" height="240" src="{$GetInstallDir}web/img/001.jpg">
                      </a>
                  </li>
      <li>
                      <a target="_blank" href="" title="">
                        <img width="960" height="240" src="{$GetInstallDir}web/img/002.jpg">
                      </a>
                  </li>
    <li>
                      <a target="_blank" href="" title="">
                        <img width="960" height="240" src="{$GetInstallDir}web/img/003.jpg">
                      </a>
                  </li>
    <li>
                      <a target="_blank" href="" title="">
                        <img width="960" height="240" src="{$GetInstallDir}web/img/004.jpg">
                      </a>
                  </li>
    <li>
                      <a target="_blank" href="" title="">
                        <img width="960" height="240" src="{$GetInstallDir}web/img/005.jpg">
                      </a>
                  </li>
    <li>
                      <a target="_blank" href="" title="">
                        <img width="960" height="240" src="{$GetInstallDir}web/img/006.jpg">
                      </a>
                  </li>
    <li>
                      <a target="_blank" href="" title="">
                        <img width="960" height="240" src="{$GetInstallDir}web/img/007.jpg">
                      </a>
                  </li>
                        
            </div>
                   
                   
            <div class="focus_page list_num">
              <li class="on">1</li>
              <li class="">2</li>
              <li class="">3</li>
    <li class="">4</li>
    <li class="">5</li>
    <li class="">6</li>
    <li class="">7</li>
            </div>
        </div>
  • 相关阅读:
    Practical .NET2 and C#2 翻译样章
    Resume
    Double Dispatch And Visitor Pattern
    Separate Contract from Implementation
    Kerberos简介
    责任分离的思想 oo dp orm aop
    Resources on Debugging/Tracing WPF
    沿着“重用”我们一路走来——SA、OO(DP)、Component、SOA、AOP
    Enterprise Test Driven Develop
    How does ElementName Binding work – Part 2 BindingExpression
  • 原文地址:https://www.cnblogs.com/walter371/p/4057957.html
Copyright © 2011-2022 走看看