背景图片

Focus on Small & Medium Construction Machinery

LuXin Company offers customizations (labels, packaging, colors, sizes, logos, graphics). Our products include road rollers, lighting towers, mini excavators, skid steer loaders, electric forklifts, sold to NA, SA, Africa, Eastern Europe, Oceania, SE Asia, with 12-month warranty.

`; // 尝试打开新窗口 const features = `width=${popupWidth},height=${popupHeight},left=${left},top=${top},resizable=yes,scrollbars=no,toolbar=no,menubar=no,location=no,status=no`; console.log('Opening popup with features:', features); try { const popup = window.open('', 'videoPlayer_' + Date.now(), features); if (popup) { popup.document.open(); popup.document.write(videoPage); popup.document.close(); // 焦点到新窗口 popup.focus(); console.log('Popup opened successfully'); } else { console.log('Popup was blocked'); // 如果弹窗被阻止,备用方案:在新标签页中打开视频 const newTab = window.open(videoUrl, '_blank'); if (!newTab) { alert('Video player was blocked. Please allow popups for this site, or click the video link manually.'); // 如果新标签页也被阻止,显示链接让用户手动点击 console.log('All popup methods blocked'); } } } catch (error) { console.error('Error opening video popup:', error); // 出错时直接在新标签页打开 window.open(videoUrl, '_blank'); } }// 为所有视频播放按钮添加点击事件 - 修复版本 function initializeVideoButtons() { console.log('Initializing video buttons...'); // 只选择当前容器中的视频按钮 const videoButtons = document.querySelectorAll('.stk-1284f2b .stk-block-video-popup__overlay'); console.log('Found video buttons:', videoButtons.length); videoButtons.forEach((button, index) => { // 移除之前可能添加的事件监听器 button.removeEventListener('click', handleVideoClick); button.removeEventListener('keydown', handleVideoKeydown); // 添加新的事件监听器 button.addEventListener('click', handleVideoClick); button.addEventListener('keydown', handleVideoKeydown); // 确保按钮是可点击的 button.style.cursor = 'pointer'; button.setAttribute('role', 'button'); button.setAttribute('tabindex', '0'); console.log(`Button ${index} initialized`); }); }// 处理视频点击事件 function handleVideoClick(event) { console.log('Video button clicked'); event.preventDefault(); event.stopPropagation(); openVideoPopup(this); }// 处理键盘事件 function handleVideoKeydown(event) { if (event.key === 'Enter' || event.key === ' ') { console.log('Video button activated via keyboard'); event.preventDefault(); event.stopPropagation(); openVideoPopup(this); } }// 页面加载完成后初始化 document.addEventListener('DOMContentLoaded', function() { console.log('DOM loaded, initializing video buttons'); initializeVideoButtons(); // 如果页面是通过Ajax加载的,可能需要监听DOM变化 const observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { if (mutation.addedNodes.length) { // 检查是否添加了当前容器的元素 const addedNodes = Array.from(mutation.addedNodes); const hasOurContainer = addedNodes.some(node => { return node.nodeType === 1 && ( node.classList?.contains('stk-1284f2b') || node.querySelector('.stk-1284f2b') ); }); if (hasOurContainer) { setTimeout(initializeVideoButtons, 100); } } }); }); // 观察整个文档的变化 observer.observe(document.body, { childList: true, subtree: true }); });// 确保函数在全局作用域中可用 window.openVideoPopup = openVideoPopup; window.initializeVideoButtons = initializeVideoButtons;// 如果DOM已经加载完成,立即初始化 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', initializeVideoButtons); } else { initializeVideoButtons(); }

PRODUCT DISPLAY

Small and medium-sized Road Rollers, Mini Excavators, Skid Steer Loaders, Lighting Towers, Forklifts, Lawn Mowers, and other construction machinery.

All Products
工程机械板块组件(优化版)
luxinroller NEWS
LUXIN LATEST NEWS
正在加载最新资讯...

GET A FREE QUOTE

官网联系侧边栏