提交修改

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

Loading…
Cancel
Save