var curPage = 0; var pageLen = 6; var totalLen = $("#new-video li").length; var V = { init : function(){ V.scrollNews(); V.triggerTab("hotVd-tab"); }, scrollNews : function() { // 新闻翻滚 var $scrollNews = $('#scrollNews'); if (!$scrollNews) return; var news = $scrollNews.children(), len = news.length, cHeight = $scrollNews.height(), perHeight = cHeight / len, interval = 2000, index = 0,//初始记录 timer = setInterval(function () { $scrollNews.animate({ top: - (perHeight * index) + "px" }, interval / 3) if (index === len - 1) index = 0; else index++; }, interval); }, triggerTab : function(id){ //tab切换 $ul=$("#"+id); $ul.on("click","li",function(){ var index = $(this).index(); $(this).addClass("active").siblings().removeClass("active"); $($(this).attr("data-id")).show().siblings("ul").hide(); $ul.parent().find(".more").eq(index).show().siblings(".more").hide(); }) } } var C = { init : function(){ C.initFullAd() C.initYYLiveAd() // 最新视频刷新 $(".col-right").on("click",".refresh",function(){ ++curPage; if(curPage >= totalLen/pageLen){ curPage = 0; } $("#new-video li").addClass("u-hide"); for(var i=0; i= 22 && day <= 24) { // if(hour >= 15 || hour <= 10) { // isTime = true; // } // } else if(month == 7 && day >= 25 && day <= 26) { // isTime = true; // } // if(isTime == false) { // return; // } /** 广告时间判断 E */ var isInitFullDa = $.cookie("isInitFullDa"); var hasDa = $(".mod-da-full img").length; if(isInitFullDa != 1 && hasDa > 0) { $(".o-wrap").append("
") $(".fullDa-inner").append($(".mod-da-full").html()) $(".o-wrap").on("click", ".fullDa-wrap em", function() { $(".fullDa-wrap").remove(); }) $.cookie("isInitFullDa", 1, { expires : 1, path : "/" }) } }, initYYLiveAd : function() { $.ajax({ url: 'http://da.duowan.com/loc/158', type: 'GET', dataType: 'jsonp', success: function(ret) { var locid = ret.locid var pid = ret.pid var item = ret.extraJson.list[0] var dom = '
  • '+item.name+' '+item.desc+'

  • ' $("#new-video li").eq(5).replaceWith(dom) } }) } } C.init(); V.init();