1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| $(function () { function appendInfoText(toolBarText) { if (toolBarText !== "") { var html = `<div id="infoBarDiv" style="position:relative; overflow:hidden; width:100%; height:36px; line-height:36px;"> <div style="position:absolute; left:0; top:0; white-space:nowrap; overflow:hidden;" id="infoBarText">${toolBarText}</div> </div>`; $(".elfinder-toolbar").append(html); if (window.innerWidth < $("#infoBarText").width()) { roll(3, "#infoBarDiv", "#infoBarText"); } else { $("#infoBarDiv").css("text-align", "center"); $("#infoBarText").css("position", ""); } } } async function getMyDataToolbarPrompts() { try { var response = await fetch("xxxxxxx"); var data = await response.json(); appendInfoText(data.data); } catch (error) { console.warn("请求失败:", error); } } getMyDataToolbarPrompts(); function roll(speed = 3, box, text) { var $box = $(box); var $text = $(text); var containerWidth = $box.width(); var contentWidth = $text.width(); $text.css("left", (containerWidth - 100) + "px"); var scroll = () => { $text.animate({left: -contentWidth}, speed * 10000, "linear", () => { $text.css("left", (containerWidth - 100) + "px"); scroll(); }); }; scroll(); let isMouseOver = false;
$text.mouseenter(() => { isMouseOver = true;$text.stop(); });
$text.mouseleave(() => { isMouseOver = false;scroll(); }); } });
|