zoukankan      html  css  js  c++  java
  • jquery 图片切换

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="wcfas.aspx.cs" Inherits="GL.Newera.wcfas" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>图片左右滚动</title>
    <script src="http://www.codefans.net/ajaxjs/jquery-1.6.2.min.js" type="text/javascript"></script>
    <script>
    //作者:刘晓帆
    //编写时间 2011年12月5日
    $(function(){
        var ul = $(".lxfscroll ul");
        var li = $(".lxfscroll li");
        var tli = $(".lxfscroll-title li");    
        var speed = 350;
        var autospeed = 3000;    
        var i=1;
        var index = 0;
        var n = 0;
        /* 标题按钮事件 */
        function lxfscroll() {
            var index = tli.index($(this));                    
            tli.removeClass("cur");
            $(this).addClass("cur");
            
            ul.css({"left":"0px"});    
            li.css({"left":"0px"});
            li.eq(index).css({"z-index":i});    
            li.eq(index).css({"left":"400px"});    
            ul.animate({left:"-400px"},speed);     
            i++;    
                
        };
        /* 自动轮换 */
        function autoroll() {
            if(n >= 4) {
                n = 0;
            }
            tli.removeClass("cur");
            tli.eq(n).addClass("cur");
            ul.css({"left":"0px"});    
            li.css({"left":"0px"});
            li.eq(n).css({"z-index":i});    
            li.eq(n).css({"left":"400px"});    
                 
            n++;
            i++;
            timer = setTimeout(autoroll, autospeed);
            ul.animate({left:"-400px"},speed);
        };
        /* 鼠标悬停即停止自动轮换 */
        function stoproll() {
            li.hover(function() {
                clearTimeout(timer);
                n = $(this).prevAll().length+1;
            }, function() {
                timer = setTimeout(autoroll, autospeed);
            });
            tli.hover(function() {
                clearTimeout(timer);
                n = $(this).prevAll().length+1;
            }, function() {
                timer = setTimeout(autoroll, autospeed);
            });
        };            
        tli.mouseenter(lxfscroll);
        autoroll();
        stoproll();
    });
    </script>
    <style type="text/css">
    * {
        font-size:12px;
        color:#333;
        text-decoration:none;
        padding:0;
        margin:0;
        list-style:none;
        font-style: normal;
        font-family: Arial, Helvetica, sans-serif;
    }
    .lxfscroll {
        400px;
        margin-left:auto;
        margin-right:auto;
        margin-top: 20px;
        position: relative;
        height: 300px;
        border: 4px solid #EFEFEF;
        overflow: hidden;
    }
    
    .lxfscroll ul li {
        height: 300px;
         400px;
        text-align: center;
        line-height: 300px;
        position: absolute;
        font-size: 40px;
        font-weight: bold;
    }
    .lxfscroll-title{
         400px;
        margin-right: auto;
        margin-left: auto;
    }
    .lxfscroll-title li{
        height: 20px;
         20px;
        float: left;
        line-height: 20px;
        text-align: center;
        border: 1px dashed #CCC;
        margin-top: 2px;
        cursor: pointer;
        margin-right: 2px;
    }
    .cur{
        color: #FFF;
        font-weight: bold; background:#000;
        
        
    }
    .lxfscroll ul {
        position: absolute;
    }
    </style>
    </head>
    <body>
    <div class="lxfscroll">
      <ul>
        <li><img src="img/main/P11.JPG" width="400" height="300" /></li>
        <li><img src="img/main/P8.JPG" width="400" height="300" /></li>
        <li><img src="img/main/P7.JPG" width="400" height="300" /></li>
        <li><img src="img/main/P10.JPG" width="400" height="300" /></li>
      </ul>
    </div>
    <div class="lxfscroll-title">
      <ul>
        <li class="cur">1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
      </ul>
    </div>
    </body>
    </html>
    
  • 相关阅读:
    sas中的sql(8)sql选项解析,数据字典
    sas中的sql(7)创建视图,更新视图,删除视图
    sas中的sql(6)创建表格、展现表格、插入行、删除行、规定限制条件(constriants)、处理输入错误(undo策略)、update表格、更改列
    sas中的sql(5) 纵向操作数据集 Except、Intersect、Union、OuterUnion
    sas中的sql(3) 标签,格式化输出,关联与非关联子查询子查询,大于两张表的联合查询(暂缺)
    iOS系统的沙盒机制
    Objective-C中一种消息处理方法performSelector
    IOS开发之关键字category详解
    IOS开发之百度地图API应用
    用法总结:viewDidLoad/viewDidUnload, loadView
  • 原文地址:https://www.cnblogs.com/sarahVSEve/p/3492432.html
Copyright © 2011-2022 走看看