|
|
var $ = require('yoho-jquery'),
|
|
|
Swiper = require('yoho-swiper'),
|
|
|
tip = require('../plugin/tip'),
|
|
|
loading = require('../plugin/loading'),
|
|
|
lazyLoad = require('yoho-jquery-lazyload');
|
|
|
|
|
|
var plusstar = {};
|
|
|
|
|
|
require('../common');
|
|
|
lazyLoad($('img.lazy'));
|
|
|
|
|
|
// 头部banner轮播
|
|
|
if ($('.banner-swiper').find('li').size() > 1) {
|
|
|
new Swiper('.banner-swiper', {
|
|
|
lazyLoading: true,
|
|
|
lazyLoadingInPrevNext: true,
|
|
|
loop: true,
|
|
|
autoplay: 3000,
|
|
|
autoplayDisableOnInteraction: false,
|
|
|
paginationClickable: true,
|
|
|
slideElement: 'li',
|
|
|
pagination: '.banner-top .pagination-inner'
|
|
|
});
|
|
|
} |
|
|
plusstar = {
|
|
|
init: function() {
|
|
|
var that = this, $liDom;
|
|
|
|
|
|
//事情委托机制
|
|
|
$('.plusstar-page .tab-nav ul').bind('click', function(even) {
|
|
|
$liDom = $(event.target).closest('li');
|
|
|
$(this).find('li').removeClass('focus');
|
|
|
$liDom.addClass('focus');
|
|
|
that.tabNav($liDom.data('code'));
|
|
|
});
|
|
|
|
|
|
switch (window.cookie('_Channel')) {
|
|
|
case 'girls':
|
|
|
$liDom = $('.plusstar-page .tab-nav ul li:eq(1)');
|
|
|
break;
|
|
|
case 'lifestyle':
|
|
|
$liDom = $('.plusstar-page .tab-nav ul li:eq(2)');
|
|
|
break;
|
|
|
default:
|
|
|
$liDom = $('.plusstar-page .tab-nav ul li:eq(0)');
|
|
|
break;
|
|
|
}
|
|
|
that.tabNav($liDom.data('code'));
|
|
|
},
|
|
|
tabNav: function(code) {
|
|
|
loading.showLoadingMask();
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/guang/plusstar/resources-template',
|
|
|
data: {
|
|
|
code: code
|
|
|
},
|
|
|
dataType: 'html',
|
|
|
success: function(data) {
|
|
|
if (data === '') {
|
|
|
tip.show('没有更多内容了');
|
|
|
}
|
|
|
|
|
|
$('.plusstar-resources').html(data);
|
|
|
|
|
|
loading.hideLoadingMask();
|
|
|
lazyLoad($('img.lazy'));
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('网络断开连接了~');
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
$(function() {
|
|
|
plusstar.init();
|
|
|
}); |
|
|
\ No newline at end of file |
...
|
...
|
|