: 이동
$("#marquee").wrapInner("span"); // wrap "My Text" with a new span
$("#marquee").append($("#marquee span").clone().hide()); // now there are two spans with "My Text"
및 스팬을 교환하는 것은 : 중복에 대한
<div id="marquee">My Text</div>
, 나는 이런 식으로 뭔가를 할 거라고 꽤 쉽습니다. 다음은 완전한 기능의 예입니다.
$(function() {
var marquee = $("#marquee");
marquee.css({"overflow": "hidden", "width": "100%"});
// wrap "My Text" with a span (old versions of IE don't like divs inline-block)
marquee.wrapInner("<span>");
marquee.find("span").css({ "width": "50%", "display": "inline-block", "text-align":"center" });
marquee.append(marquee.find("span").clone()); // now there are two spans with "My Text"
// create an inner div twice as wide as the view port for animating the scroll
marquee.wrapInner("<div>");
marquee.find("div").css("width", "200%");
// create a function which animates the div
// $.animate takes a callback for when the animation completes
var reset = function() {
$(this).css("margin-left", "0%");
$(this).animate({ "margin-left": "-100%" }, 3000, 'linear', reset);
};
// kick it off
reset.call(marquee.find("div"));
});
See it in action
면책 조항 :
나는 어떤 전문 웹 사이트에 대한이 사용하지 않는 것이 좋습니다. 그러나 역 1990의 모습을 재현하려는 경우 유용 할 수 있습니다.
1995 년처럼 파티합시다! – Kevin
당신의 성향이 정확합니다. –
방금 플러그인을 만들었습니다. 이 도움이 되길 바래 :) https://github.com/aamirafridi/jQuery-Marquee –