zoukankan      html  css  js  c++  java
  • 图片轮播 及通知公告上滚动 (无空隙滚动)

    图片轮播

    1、样式

    <style>
            #banner {
                padding: 0px;
                width: 404px;
                height: 260px;
            }
    
            .slides {
                width: 404px;
                height: 260px;
                overflow: hidden;
                position: relative;
            }
    
            .slide-pic {
                margin: 0px;
                padding: 0px;
                width: 404px;
                overflow: hidden;
            }
    
                .slide-pic img {
                    width: 404px;
                    height: 260px;
                }
    
                .slide-pic li {
                    display: none;
                }
    
                    .slide-pic li.cur {
                        display: block;
                    }
    
            .slide-li {
                z-index: 1;
                margin: 0px;
                padding: 0px;
                left: 40%;
                bottom: 30px;
                position: absolute;
            }
    
                .slide-li li {
                    width: 111.5px;
                    height: 10px;
                    float: left;
                    /*margin-right: 3px;*/
                    border-radius: 50%;
                    overflow: hidden;
                    list-style: none;
                }
    
                .slide-li a {
                    height: 15px;
                    color: #000;
                    font-size: 12px;
                    display: block;
                }
    
                    .slide-li a:hover {
                        color: #d7d7d7;
                        text-decoration: none;
                    }
    
            .op li {
                border: 2px solid transparent;
                background: #d7d7d7;
                filter: alpha(opacity=100);
                opacity: 1;
                width: 10px;
                margin-right: 5px;
            }
    
                .op li.cur {
                    border-color: #48b2e2;
                }
    
            .slide-txt {
                z-index: 0;
                width: 100%;
                background: rgba(0, 0, 0,0.5);
                height: 47px;
                bottom: 0px;
                left: 0px;
            }
    
                .slide-txt li {
                    text-align: center;
                    padding-top: 25px;
                    height: 20px;
                    width: 100%;
                }
    
                    .slide-txt li a {
                        font-size: 14px;
                        color: white;
                        text-decoration: none;
                    }
    
                .slide-txt span {
                    /*display: none;*/
                }
    
    
    
    
            .news_img .wenhuaBG {
                position: absolute;
                top: 0px;
            }
    
            .wenhua_cont {
                width: 680px;
                height: 150px;
                overflow: hidden;
                line-height: 29px;
                position: absolute;
                left: 125px;
                top: 83px;
                color: #735440;
            }
    
            .cont_box3 .tit_border {
                border-top: solid #530b00 7px;
                height: 11px;
                border-bottom: dotted #530b00 1px;
                margin-bottom: 10px;
            }
    
            .titcont {
                height: 65px;
            }
    
            .cont_box3 {
                height: 390px;
                width: 1200px;
                padding-top: 35px;
            }
    
            .product_cont {
                width: 915px;
            }
    
            .cont_box3 .news_what {
                width: 252px;
                float: right;
            }
    
                .cont_box3 .news_what .imgps {
                    margin-bottom: 10px;
                }
    
                .cont_box3 .news_what p a {
                    color: #735440;
                    background: url("../images/home_33.jpg") no-repeat left;
                    padding-left: 15px;
                    line-height: 28px;
                }
    
                .cont_box3 .news_what .imgps a {
                    background: none;
                    padding: 0px;
                }
    
            .box {
                width: 100%;
                margin: 0 auto;
                position: relative;
                overflow: hidden;
                _height: 100%;
            }
    
            .picbox {
                width: 100%;
                height: 285px;
                overflow: hidden;
                position: relative;
            }
    
            .piclist {
                height: 285px;
                position: absolute;
                left: 0px;
                top: 0px;
            }
    
                .piclist li { /*margin-right:40px;*/
                    padding: 5px;
                    float: left;
                    width: 212px;
                    overflow: hidden;
                }
    
                .piclist img {
                    width: 211px;
                    height: 194px;
                }
    
                .piclist li h4 {
                    font-size: 14px;
                    line-height: 35px;
                    padding-top: 10px;
                }
    
                    .piclist li h4 a {
                        color: #530b00;
                    }
    
                .piclist li img:hover {
                    box-shadow: 5px 5px 5px #ccc;
                }
    
                .piclist li p {
                    color: #735440;
                    font-size: 12px;
                }
    
            .swaplist {
                position: absolute;
                left: -3000px;
                top: 0px;
            }
    
            .og_prev, .og_next {
                width: 30px;
                height: 50px;
                background: url(../images/icon.png) no-repeat;
                background: url(../images/icon_ie6.png) no-repeat9;
                position: absolute;
                top: 75px;
                z-index: 99;
                cursor: pointer;
                filter: alpha(opacity=70);
                opacity: 0.7;
            }
    
            .og_prev {
                background-position: 0 -60px;
                left: 4px;
            }
    
            .og_next {
                background-position: 0 0;
                right: 4px;
            }
        </style>
    图片轮播样式

    2、html

    <div class="slides">
            <ul class="slide-pic">
                <li class="" style="display: none;">
                    <a href="" target="_blank">
                        <img alt="" src="./明蜀王陵_files/201507211707196638.jpg">
                    </a>
                </li>
                <li class="" style="display: none;">
                    <a href="" target="_blank">
                        <img alt="" src="./明蜀王陵_files/201508262121384035.png">
                    </a>
                </li>
                <li class="cur" style="display: list-item;">
                    <a href="" target="_blank">
                        <img alt="" src="./明蜀王陵_files/201507211706431326.jpg">
                    </a>
                </li>
                <li class="" style="display: none;">
                    <a href="" target="_blank">
                        <img alt="" src="./明蜀王陵_files/201507211706385076.jpg">
                    </a>
                </li>
                <li class="" style="display: none;">
                    <a href="" target="_blank">
                        <img alt="" src="./明蜀王陵_files/201507211706310076.jpg">
                    </a>
                </li>
            </ul>
            <ul class="slide-li op">
                <li class=""></li>
                <li class=""></li>
                <li class="cur"></li>
                <li class=""></li>
                <li class=""></li>
            </ul>
            <ul class="slide-li slide-txt">
                <li class=""><a href="http://shu.everythingnewell.com/main.aspx#">ddd</a></li>
                <li class=""><a href="http://shu.everythingnewell.com/main.aspx#">fdfd</a></li>
                <li class="cur"><a href="http://shu.everythingnewell.com/main.aspx#">fdf</a></li>
                <li class=""><a href="http://shu.everythingnewell.com/main.aspx#">fd</a></li>
                <li class=""><a href="http://shu.everythingnewell.com/main.aspx#">fdf</a></li>
            </ul>
        </div>
    图片轮播html

    3、js

    jQuery(function ($) {
    
                $(".slide-pic li:first").addClass("cur").show();
                $(".slide-li li:first").addClass("cur").show();
                if ($(".slide-pic").length > 0) {
                    var defaultOpts = { interval: 3000, fadeInTime: 300, fadeOutTime: 200 };
                    var _titles = $("ul.slide-txt li");
                    var _titles_bg = $("ul.op li"); //ol
                    var _bodies = $("ul.slide-pic li");
                    var _count = _titles.length;
                    var _current = 0;
                    var _intervalID = null;
                    var stop = function () { window.clearInterval(_intervalID); };
                    var slide = function (opts) {
                        if (opts) {
                            _current = opts.current || 0;
                        } else {
                            _current = (_current >= (_count - 1)) ? 0 : (++_current);
                        };
                        _bodies.filter(":visible").fadeOut(defaultOpts.fadeOutTime, function () {
                            _bodies.eq(_current).fadeIn(defaultOpts.fadeInTime);
                            _bodies.removeClass("cur").eq(_current).addClass("cur");
                        });
                        _titles_bg.removeClass("cur").eq(_current).addClass("cur");
                        //_titles.removeClass("cur").eq(_current).addClass("cur");
                        _titles.hide().eq(_current).show();
                    };
                    var go = function () {
                        stop();
                        _intervalID = window.setInterval(function () { slide(); }, defaultOpts.interval);
                    };
                    var itemMouseOver = function (target, items) {
                        stop();
                        var i = $.inArray(target, items);
                        slide({ current: i });
                    };
                    _titles_bg.hover(function () { if ($(this).attr('class') != 'cur') { itemMouseOver(this, _titles_bg); } else { stop(); } }, go);
                    _bodies.hover(stop, go);
                    go();
                }
            });
    图片轮播js

    新闻上下滚动

    1、样式

    <style type="text/css">
            .renav {
                width: 200px;
                height: 40px;
                line-height: 40px;
                overflow: hidden;
            }
    
                .renav ul {
                    padding: 0px;
                }
    
                    .renav ul li {
                        list-style: none;
                        color: white;
                    }
    
                        .renav ul li a {
                            font-size: 14px;
                            list-style: none;
                            color: white;
                        }
    
                            .renav ul li a:hover {
                                color: #48b2e2;
                            }
    
                .renav li {
                    height: 40px;
                }
        </style>
    上下滚动

    2、html

    <div class="renav">
            <ul style="margin-top: 0px;">
                <li><a>你好</a></li>
                <li><a>成都</a></li>
                <li><a>四川</a></li>
                <li><a>眉山</a></li>
                <li><a>乐山</a></li>
                <li><a>资阳</a></li>
                <li><a>简阳</a></li>
                <li><a>水库</a></li>
            </ul>
        </div>
    View Code

    3、js

    <script>
            $(function () {
                var $this = $(".renav");
                var scrollTimer;
                $this.hover(function () {
                    clearInterval(scrollTimer);
                }, function () {
                    scrollTimer = setInterval(function () {
                        scrollNews($this);
                    }, 2000);
                }).trigger("mouseout");
            });
            function scrollNews(obj) {
                var $self = obj.find("ul:first");
                var lineHeight = $self.find("li:first").height();
                $self.animate({ "margin-top": -lineHeight + "px" }, 600, function () {
                    $self.css({ "margin-top": "0px" }).find("li:first").appendTo($self);
                })
            }
        </script>
    jquery
  • 相关阅读:
    读Windows核心编程2字符和字符串
    HTTP Error 404.3 while browse to WCF service
    读Windows核心编程3内核对象
    代码安全性的基本原则[转载]
    在HyperV中安装和配置Ubuntu网络
    使用Windows Azure Mobile Service开发Windows Phone 8 App
    Js 学习 使用js arguments 写一个 多态overload 的小程序。 js 闭包写一个10的阶乘的算法
    js 学习 函数
    jquery slider show carouFredSel
    vs 2010 创建windows phone 程序 出现System.ArgumentNullException Value cannot be null. Parameter name: parentContext
  • 原文地址:https://www.cnblogs.com/lovable/p/7131136.html
Copyright © 2011-2022 走看看