$(function() { $('.i_nav .i_n0').each((i, item) => { $(item).addClass('cur'+i) }) console.log(111) }) $(function() { if ($('body').hasClass('products') || $('body').hasClass('news')) { $('.sortnavul .sortnavli .sortnava').each((index, item) => { console.log($(item).attr('href')) let sortid = $(item).attr('href').split('sortid=')[1] if ($('body').attr('data-soid') === sortid) { $(item).addClass('on') } }) } }) $(function() { if($(window).width() <= 768) { // $('.header').append('') if ($('.i_nav_btn')) { $('.i_nav_btn').on('click', function() { $('.i_nav').slideToggle() }) } $('.nava').each((i, item) => { if ($(item).html() != '首页' && $(item).html() != '联系我们' ) { item.href = 'javascript:void(0);' } }) } }) $(function() { if ($('body').width() <= 768) { $('.index .in-case .sort_l ul li a').attr('href', 'javascript:;') } }) // $(function () { // if ($(window).width() < '500') { // $(".b-banner").each(function () { // $(this).attr("src", $(this).parent().attr('href')); // }); // $('.pimg_banner img').attr('src', $('.pimg_banner').attr('href')) // } // }); $(function() { if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) { $('.in-case .i_newlist ul li').on('click', function() { $(this).addClass('active').siblings().removeClass('active') }) } }) // 分页只显示三页 $(function() { $('.pagebarCurrent').parent().addClass('nextPagesBlock') if ($('.pagebarCurrent').html() == 1) { $('.pagebarCurrent').parent().next().addClass('nextPagesBlock') $('.pagebarCurrent').parent().next().next().addClass('nextPagesBlock') } else if ($('.pagebarCurrent').html() == $('.navPage ul li').length - 4) { $('.pagebarCurrent').parent().prev().addClass('nextPagesBlock') $('.pagebarCurrent').parent().prev().prev().addClass('nextPagesBlock') } else { $('.pagebarCurrent').parent().prev().addClass('nextPagesBlock') $('.pagebarCurrent').parent().next().addClass('nextPagesBlock') } $('.navPage ul li').each((index, item) => { console.log($(item).children('a').html()) if ($(item).children('a').html() == '>>' || $(item).children('a').html() == '|<' || $(item).children('a').html() == '<<' || $(item).children('a').html() == '>|') { $(item).addClass('nextPagesBlock') } }) })