123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- 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(){
- // 最新视频刷新
- $(".col-right").on("click",".refresh",function(){
- ++curPage;
- if(curPage >= totalLen/pageLen){
- curPage = 0;
- }
- $("#new-video li").addClass("u-hide");
- for(var i=0; i<pageLen; i++){
- var $curLi = $("#new-video li").eq(curPage*pageLen+i);
- var $curImg = $curLi.find("img");
- var original = $curImg.attr("data-original");
- if(original){
- $curImg.removeAttr("data-original").attr("src",original);
- }
- $curLi.removeClass("u-hide");
- }
- });
- }
- }
- C.init();
- V.init();
|