news', '378', 1); }) // 生成微信扫描二维码 $('.wxewm').qrcode({ text: "https://www.8buy.cn/post/378.html", width: 100, height: 100 }); //手机端导航函数 开和关 function toggleMenu() { var navDaohang = document.getElementById('navDaohang'); if (navDaohang.style.left === '0px') { navDaohang.style.left = '-200px'; // 将导航栏移回屏幕外 } else { navDaohang.style.left = '0px'; // 将导航栏移动到屏幕内 } } //手机端导航关闭按钮 function closeNav(){ var navDaohang = document.getElementById('navDaohang'); navDaohang.style.left = '-200px'; // 将导航栏移回屏幕外 } // 分享复制网址 function copyCurrentUrl(event) { // 阻止链接的默认行为(即导航) event.preventDefault(); // 获取当前网页的 URL const currentUrl = window.location.href; // 创建一个临时的文本输入框 const tempInput = document.createElement('input'); // 将当前网页的 URL 赋值给临时的文本输入框 tempInput.value = currentUrl; // 将临时输入框添加到 DOM 中 document.body.appendChild(tempInput); // 选择临时输入框中的文本 tempInput.select(); // 执行复制操作 document.execCommand('copy'); // 移除临时输入框 document.body.removeChild(tempInput); // 提示用户 URL 已复制 showPopup("已复制链接", 2500); } //鼠标划过,显示微信二维码 $(document).ready(function(){ // 当鼠标进入 标签时触发事件 $('.weixin i').mouseenter(function(){ // 执行你的代码,比如显示一个提示框或者执行其他操作 $(".wxewm").css("display","block"); }); // 当鼠标离开 标签时触发事件 $('.weixin i').mouseleave(function(){ // 执行你的代码,比如隐藏提示框或者执行其他操作 $(".wxewm").css("display","none"); }); }); //点击量统计 $.ajax({ type: "GET", url: "https://www.8buy.cn/index.php?s=api&c=module&siteid=1&app=news&m=hits&id=378", dataType: "jsonp", success: function(data) { if (data.code) { $(".dr_show_hits_378").html(data.msg); } } }); // 如果是pc端就钉住右侧 if (IsPC()){ var element = document.querySelector('.xgtj'); //获取目标 element.style.width = window.getComputedStyle(element).getPropertyValue('width'); //修改目标宽度 var module = document.getElementById('fixedModule'); var modulePosition = module.getBoundingClientRect().top; var isFixed = false; window.addEventListener('scroll', function() { var scrollPosition = window.pageYOffset || document.documentElement.scrollTop; if (scrollPosition >= modulePosition && !isFixed) { module.classList.add('fixedss'); isFixed = true; }else if (scrollPosition < modulePosition && isFixed) { module.classList.remove('fixedss'); isFixed = false; } }); }