$(function () { //图片滚动特效 $('#asid_share').hhShare({ cenBox: 'asid_share_box', //里边的小层 icon: 'adid_icon', addClass: 'red_bag', titleClass: 'asid_title', triangle: 'asid_share_triangle', //鼠标划过显示图层,边上的小三角 showBox: 'asid_sha_layer' //鼠标划过显示图层 }); var browerVersion = IEVersion(); var doc = null; if (browerVersion == -1) { doc = document; } else { doc = window; } $(doc).on("scroll", function () { var scrollTopHeight = $(this).scrollTop(); var topHeight = 260; const titleWidth = $('.main').find('.menu .menu-p .btn-title').eq(0).outerWidth() const windowWidth = ($(window).width() - 966) / 2 const menuPos = ($(window).width() - 966) / 2 if (scrollTopHeight > topHeight) { $('.main').addClass('p-fix') $('.main').children('.menu').addClass('fix-bar') $('.p-fix').css({ 'padding-left': titleWidth + 20 + 'px' }) $('.fix-bar').css({ 'left': menuPos + 'px' }) } else { $('.p-fix').css({ 'padding-left': '0' }) $('.fix-bar').css({ 'left': '0' }) $('.main').children('.menu').removeClass('fix-bar') $('.main').removeClass('p-fix') } }); $('.main').each(function () { const $menu = $(this).children('.menu').eq(0) const $choose = $menu.find('.menu-p .tabbar .choose') const $main = $(this).children('.content').eq(0) const $navigate = $main.children('.navigate').eq(0) const $tab = $main.find('#tabContent').eq(0) if ($tab.length > 0) { $choose.bind('click', function () { const _this = $(this) const index = _this.index() const navigate = _this.html() $(this).addClass('active').siblings('.choose').removeClass('active') showPane($tab, index) $navigate.find('.nav-tag').empty().html(navigate) }) } }) }); function showPane(obj, index) { // const bannerHeight = $('.title-bar').height() + $('body .contain').children('.banner-wrap').eq(0).height() const $obj = obj.children('.tab-content-page').eq(index) $obj.show().siblings('.tab-content-page').hide() $('body').scrollTop(0) }