!(function () {
// 这段脚本主要处理轮播图相关的
$(document).ready(function () {
$('#ul1').slick({
autoplay: true,
autoplayspeed: 3000,
dots: true,
prevarrow: '.slide--pre',
nextarrow: '.slide--next',
dotsclass: 'dots-container',
custompaging: function (i) {
return '';
},
});
$('#ul2').slick({
autoplay: true,
autoplayspeed: 3000,
dots: true,
adaptiveheight: true,
dotsclass: 'dots-container',
custompaging: function (i) {
return '';
},
});
// 监听图片 change 事件
var setimgtext = function (index) {
$('.slide-panel p:not(:nth-child('.concat(index, '))')).hide();
$('.slide-panel p:nth-child('.concat(index, ')')).show();
};
var setimgtextpos = function (px) {
// 由于图片大小是动态的,这里只能用 js 来设置元素top的值
$('.slide-banner .slide-panel').css('top', px - 32 + 'px');
};
$('#ul1').on('afterchange', function (event, slick, currentslide) {
var docelement = document.documentelement;
var clientwidth = docelement.clientwidth;
var ismobile = clientwidth < 769;
var slidebannerheight = $('.slide-banner').get(0).clientheight;
var slideheight = slick.$list.get(0).clientheight;
// if (ismobile) {
// setimgtextpos(math.min(slidebannerheight, slideheight))
// }
setimgtext(currentslide + 1);
});
setimgtext(1);
// console.log('imgs :>> ', $('.book-item>img:nth-child(1)'));
});
// 这段脚本标主要控制轮播图右边栏目的 tab 切换
$(document).ready(function () {
var curtabkey = 'news';
var settabkey = function (key) {
$('.column-title:not([data-key='.concat(key, '])')).removeclass('selected');
$('.column-news-content ul:not([data-key='.concat(key, '])')).removeclass('on-view');
$('.column-more-info:not([data-key='.concat(key, '])')).removeclass('selected');
$('.column-more-info[data-key='.concat(key, ']')).addclass('selected');
$('.column-title[data-key='.concat(key, ']')).addclass('selected');
$('.column-news-content ul[data-key='.concat(key, ']')).addclass('on-view');
curtabkey = key;
};
$('.column-title').on('click', function (e) {
var data_key = _dataset(e.target);
if (data_key && data_key.key) {
settabkey(data_key.key);
}
});
// $('.column-title').on('mouseover', (e) => {
// if (e.target.dataset && e.target.dataset.key) {
// settabkey(e.target.dataset.key)
// }
// })
settabkey(curtabkey);
});
})();