提交修改

new-v20240713
dshclm 8 months ago
parent 887b131027
commit b7f9cf49cb

@ -71,7 +71,7 @@
<a th:href="@{/special_view.html(columnId=${specialColumns[0].columnId})}" th:title="${specialColumns[0].columnName}" target="_blank"> <a th:href="@{/special_view.html(columnId=${specialColumns[0].columnId})}" th:title="${specialColumns[0].columnName}" target="_blank">
<img style="width: 100% ;filter: brightness(1.1);" th:src="${specialColumns[0].columnUrl}" th:alt="${specialColumns[0].columnName}"> <img style="width: 100% ;filter: brightness(1.1);" th:src="${specialColumns[0].columnUrl}" th:alt="${specialColumns[0].columnName}">
</a> </a>
<a onclick="closeAd()"><span>关闭</span></a> <a id="closeButton"><span>关闭</span></a>
</div> </div>
<div class="layui-container" style="min-width: 1330px"> <div class="layui-container" style="min-width: 1330px">
<div class="notice"> <div class="notice">
@ -523,42 +523,47 @@
$('.myscroll').myScroll({ $('.myscroll').myScroll({
speed: 30, speed: 30,
}); });
document.addEventListener('DOMContentLoaded',function(){
var el = document.querySelector('#ad');
if (el){
var styleTop = 0;
var styleLeft = 0;
var verticalFlag = true;
var horizontalFlag = true;
var isMouseOver = false; // 新变量用于跟踪鼠标是否在元素上
var el = document.querySelector('#ad'); // 设置定时器的函数
var styleTop = 0; function moveElement() {
var styleLeft = 0; if (!isMouseOver) { // 如果鼠标不在元素上,则继续移动
var verticalFlag = true; verticalFlag ? styleTop++ : styleTop--;
var horizontalFlag = true; horizontalFlag ? styleLeft++ : styleLeft--;
var isMouseOver = false; // 新变量用于跟踪鼠标是否在元素上
// 设置定时器的函数 (styleTop <= 0 || styleTop >= window.innerHeight - el.offsetHeight) && (verticalFlag = !verticalFlag);
function moveElement() { (styleLeft <= 0 || styleLeft >= window.innerWidth - el.offsetWidth) && (horizontalFlag = !horizontalFlag);
if (!isMouseOver) { // 如果鼠标不在元素上,则继续移动
verticalFlag ? styleTop++ : styleTop--;
horizontalFlag ? styleLeft++ : styleLeft--;
(styleTop <= 0 || styleTop >= window.innerHeight - el.offsetHeight) && (verticalFlag = !verticalFlag); el.style.top = styleTop +'px';
(styleLeft <= 0 || styleLeft >= window.innerWidth - el.offsetWidth) && (horizontalFlag = !horizontalFlag); el.style.left = styleLeft + 'px';
}
el.style.top = styleTop +'px'; }
el.style.left = styleLeft + 'px';
}
}
setInterval(moveElement, 20); setInterval(moveElement, 20);
// 添加事件监听器以检测鼠标是否在元素上 // 添加事件监听器以检测鼠标是否在元素上
el.addEventListener('mouseover', function () { el.addEventListener('mouseover', function () {
isMouseOver = true; isMouseOver = true;
}); });
el.addEventListener('mouseout', function () { el.addEventListener('mouseout', function () {
isMouseOver = false; isMouseOver = false;
}); });
function closeAd(){ }
isMouseOver = true; function closeAd(){
el.style.display = 'none' isMouseOver = true;
} el.style.display = 'none'
}
// 绑定关闭广告的按钮
document.getElementById('closeButton').addEventListener('click', closeAd);
})
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
var noticeInner = document.querySelector('.notice__inner'); var noticeInner = document.querySelector('.notice__inner');
var noticeItems = Array.from(document.querySelectorAll('.notice__item')); var noticeItems = Array.from(document.querySelectorAll('.notice__item'));

Loading…
Cancel
Save