//变量声明 var href = location.pathname; //环境区别 if (!isFrontEnv()) { console.log('在制作器中') } else { //预览网站时才执行 } //地址区别 // if(href === '/home.html'){ // } //文本换行 $('.no_blak').each(function () { let blak_text = $(this).text(); let no_blak_text = $.trim(blak_text); $(this).text(no_blak_text); }) //移动端padding调整 $('.mhw').each(function () { $(this).parents("div[id^='c_static']").addClass('mbp'); }); $('.mnw').each(function () { $(this).parents("div[id^='c_static']").addClass('mbp'); }); //修改css变量 //document.documentElement.style.setProperty('--bg-color', 'red'); // //导航 // let win_sTop = $(window).scrollTop(); // if(win_sTop != 0){ // $('#c_static_001-1672801132181').addClass('on_top'); // } // $(window).scroll(function(){ // if($(this).scrollTop() != 0){ // $('#c_static_001-1672801132181').addClass('on_top'); // }else{ // $('#c_static_001-1672801132181').removeClass('on_top'); // } // }) // //搜索出现与隐藏 // $('#c_static_001-1672801132181 .e_image-4').on('click',function(){ // $('#c_static_001-1672801132181 .e_form-6').slideToggle(); // }) // $('#c_static_001-1672801132181 .e_image-8').on('click',function(){ // $('#c_static_001-1672801132181 .e_form-6').slideToggle(); // }) //高亮 // let href = location.pathname; /*获取面包屑*/ // $(".s_list .p_list .p_loopitem a").addClass('sort_href'); // $(".s_list .p_list .p_loopitem a").each(function (i, e) { // let aa = $(e).attr("href"); /*获取a标签的href属性*/ // if (aa == href) { // // 自身样式 // $(e).parents('.p_loopitem').addClass('active') // .end().siblings('.p_loopitem').removeClass('active'); /*添加当前选中高亮样式,移除其他之前选中的的高亮样式*/ // } // }) // //分类高亮 // let href_split = href.split('/'); // if(href_split[1] === 'download'){ // $('#').eq(i).addClass('active'); // } // //分页高亮 // //记得给p_loopitem添加data-id属性,data-id="{{CID}}" // $(function(){ // $('.p_loopitem[data-id='+pageObj._detailId+']').addClass('select_click'); //+pageObj._detailId+ 因为pageObj._detailId是一个字符串变量,所以得用两个加号括起来,不然就是字符串pageObj._detailId了 // }) // //swiper引用 // $require(['swiper'], function () { // var leftSw = new Swiper('#'); // }) //wow动画 //data-wow-delay、data-wow-duration、data-wow-offset if (!isFrontEnv()) { console.log('在制作器中') } else { //预览网站时才执行 $('#c_static_640-1689584095015').addClass('fadeInUp wow'); $('#c_static_001_P_1095-16873389383770').addClass('fadeInUp wow'); } // //锚点点击 // $('#').click(function() { // $("html, body").animate({ // scrollTop: $('#').offset().top-80 //80是距离顶部距离,如果导航栏固定,则是导航栏的高度 // }, { // duration: 100, // 过渡时间 // easing: "swing" // }) // }) // //点击效果 // $('#').click(function(){ // $(this).next().slideToggle(300).end().toggleClass('clicked'); // }) // //板块进入视口时对应的变化 // $('#').each(function(){ // let ele_h = $(this).height(); // let ele_top = $(this).offset().top; // let ele_index = $(this).index(); // $(window).scroll(function(){ // let sco_top = $(this).scrollTop()+175; //175时导航栏固定时的高度 // if((sco_top - ele_top) >=0 && (sco_top - ele_top) <= ele_h){ // //若进入视口时,该发生的对应的变化 // } // }) // }) //异步请求 // let xhr = new XMLHttpRequest(); // xhr.open('GET', url, true); // xhr.responseType = 'document'; //声明获取的数据类型为文档 // xhr.send(); // xhr.onreadystatechange = function () { // if (xhr.readyState === 4) { // if (xhr.status === 200) { // console.log(xhr.response); // console.log(cid); // } else { // console.error(xhr.statusText); // } // } // }; //判断页面向上还是向下 // let beforScroll = 0; // $(window).scroll(function(){ // let afterScroll = $(this).scrollTop(); // let det = afterScroll - beforScroll; // if(det > 0 ){ // //向下滚 // }else{ // //向上滚 // } // beforScroll = afterScroll; // }) // //检测元素的加载情况 // (function(win) { // "use strict"; // var listeners = []; // var doc = win.document; // var MutationObserver = win.MutationObserver || win.WebKitMutationObserver; // var observer; // function ready(selector, fn) { // // 储存选择器和回调函数 // listeners.push({ // selector: selector, // fn: fn, // }); // if (!observer) { // // 监听document变化 // observer = new MutationObserver(check); // observer.observe(doc.documentElement, { // childList: true, // subtree: true, // }); // } // // 检查该节点是否已经在DOM中 // check(); // } // function check() { // // 检查是否匹配已储存的节点 // for (var i = 0; i < listeners.length; i++) { // var listener = listeners[i]; // // 检查指定节点是否有匹配 // var elements = doc.querySelectorAll(listener.selector); // for (var j = 0; j < elements.length; j++) { // var element = elements[j]; // // 确保回调函数只会对该元素调用一次 // if (!element.ready) { // element.ready = true; // // 对该节点调用回调函数 // listener.fn.call(element, element); // } // } // } // } // // 对外暴露ready // win.ready = ready; // })(this); //用ready函数来监听元素加载 // ready('.foo',function(){ // }) //检测dom节点的动态变化 // 目标 div 元素 // let targetDiv = document.getElementById("target"); // // 创建一个 MutationObserver 实例 // let observer = new MutationObserver(function(mutationsList, observer) { // // 检查每个变化记录 // for (let mutation of mutationsList) { // // 检查子节点是否被添加到目标 div 元素中 // if (mutation.type === "childList" && mutation.addedNodes.length > 0) { // // 子节点添加后执行的代码 // //.. 要执行的代码 // // 在这里执行您的代码 // } // } // }); // // 配置 MutationObserver 监听子节点的添加 // let config = { // childList: true // }; // // 启动 MutationObserver 监听目标 div 元素 // observer.observe(targetDiv, config);