网站首页幻灯片

Js页面:

View Code
/**
* 大眼睛广告轮播
*/
var indexEye = {
    autoTime: 0,

    init: function () {
        var eyeObj = $("#dyj_pics a:eq(0) img:eq(0)");
        eyeObj.attr("src", eyeObj.attr("data-imgSrc"));
        eyeObj.load(function () {
            indexEye.autoTime = setTimeout(function () {
                indexEye.autoPlay();
            }, 10000);
        });

        $("#dyj_numqu a").live("mouseover", function () {
            if ($(this).attr("class") == "on") return;
            indexEye.autoPlay(this);
        });
    },

    autoPlay: function (me) {
        clearTimeout(this.autoTime);
        this.turnNumber(me);
        var now = $("#dyj_numqu a.on").index();
        var imgObj = $("#dyj_pics a").eq(now).children("img");
        //if(imgObj.attr("src") == "") {
        imgObj.attr("src", imgObj.attr("data-imgSrc"));
        //}
        setTimeout(function () {
            $("#dyj_pics a:visible").fadeOut(0, function () {
                $("#dyj_pics a").eq(now).fadeIn(0);
            });
        }, 200);
        this.autoTime = setTimeout("indexEye.autoPlay()", 6000);
    },

    turnNumber: function (me) {
        if (typeof (me) == 'undefined') {
            var i = $("#dyj_numqu a.on").index();
            i = i >= $("#dyj_numqu a").length - 1 ? 0 : i + 1;
            me = $("#dyj_numqu a").eq(i);
        }
        $("#dyj_numqu a.on").each(function () {
            $(this).removeClass();
        });
        $(me).addClass('on');
    }
}

 

cshtml页面: 

View Code
View Code

<!--大眼睛广告区-->
<div class="dyjGroup">
<div class="dyj_pics" id="dyj_pics">
@*<a href="http://x.uuzu.com/bulletin/24589.html" title="《大侠传》双线148区12月11日11:00开启"
target="_blank" style="display: block">
<img src="http://pic.uuzu.com/dxz/images/load.gif" data-imgsrc="http://upload.uuzu.com/daxia/2012/1210/183952663.jpg"
width="378" height="226" border="0" alt="《大侠传》双线148区12月11日11:00开启" /></a><a href="http://x.uuzu.com/active/24542.html"
title="《大侠传》叁“12”狂欢会" target="_blank" style="display: none"><img src="http://pic.uuzu.com/dxz/images/load.gif"
data-imgsrc="http://upload.uuzu.com/daxia/2012/1210/101012856.jpg" width="378"
height="226" border="0" alt="《大侠传》叁“12”狂欢会" /></a><a href="http://x.uuzu.com/active/24542.html"
title="《大侠传》叁“12”狂欢会" target="_blank" style="display: none"><img src="http://pic.uuzu.com/dxz/images/load.gif"
data-imgsrc="http://upload.uuzu.com/daxia/2012/1210/101318834.jpg" width="378"
height="226" border="0" alt="《大侠传》叁“12”狂欢会" /></a><a href="http://x.uuzu.com/media/24303.html"
title="17173中国网游风云榜" target="_blank" style="display: none"><img src="http://pic.uuzu.com/dxz/images/load.gif"
data-imgsrc="http://upload.uuzu.com/daxia/2012/1203/123337666.jpg" width="378"
height="226" border="0" alt="17173中国网游风云榜" /></a>*@
@{Html.RenderAction<PartController>(i => i.Solider());}
</div>
<div class="dyj_numqu" id="dyj_numqu">
<a href="javascript:;" class="on" alt="《大侠传》双线148区12月11日11:00开启" title="《大侠传》双线148区12月11日11:00开启">
</a><a href="javascript:;" alt="《大侠传》叁“12”狂欢会" title="《大侠传》叁“12”狂欢会">2</a><a href="javascript:;"
alt="《大侠传》叁“12”狂欢会" title="《大侠传》叁“12”狂欢会">3</a><a href="javascript:;" alt="17173中国网游风云榜"
title="17173中国网游风云榜">4</a>
</div>
</div>
<script type="text/javascript">
$(function () {
indexEye.init();
})
</script>
<!--大眼睛广告区结束-->

 

posted on 2012-12-11 17:26  douqiumiao  阅读(230)  评论(0编辑  收藏  举报