AsiaMoma/modules/text_marquee/_widget.html.erb

32 lines
1.1 KiB
Plaintext
Raw Normal View History

2021-08-30 10:13:48 +00:00
<div class="marquee-1" module="text_marquee" data-ps="">
<ul class="marquee" data-level="0" data-list="texts">
<li>{{content}}</li>
</ul>
</div>
2021-12-28 07:51:50 +00:00
2021-08-30 10:13:48 +00:00
<script type="text/javascript">
(function(){
var main_div = $("div[data-subpart-id={{subpart-id}}]"),
total_texts = main_div.find("ul li").length - 1,
current_text = 0,
2021-12-28 07:51:50 +00:00
last_text = 0,
speed = 3000;
2021-08-30 10:13:48 +00:00
main_div.find("ul li").hide();
2021-12-28 07:51:50 +00:00
function textTransform(){
2021-08-30 10:13:48 +00:00
current_text = (current_text > total_texts ? 0 : current_text);
last_text = (current_text == 0 ? total_texts : current_text - 1);
2021-12-28 07:51:50 +00:00
speed = main_div.find("ul li").eq(current_text).find("> a").eq(0).attr('speed');
main_div.find("ul li").eq(last_text).stop(true, true).slideUp({duration: 500, queue: true});
main_div.find("ul li").eq(current_text).stop(true, true).slideDown({duration: 500, queue: true});
current_text++;
2021-08-30 10:13:48 +00:00
if(total_texts > 0){
2021-12-28 07:51:50 +00:00
if(window["{{subpart-id}}_time_out_id"])
clearTimeout(window["{{subpart-id}}_time_out_id"]);
window["{{subpart-id}}_time_out_id"] = setTimeout(textTransform,speed);
2021-08-30 10:13:48 +00:00
}
2021-12-28 07:51:50 +00:00
return;
2021-08-30 10:13:48 +00:00
}
2021-12-28 07:51:50 +00:00
textTransform();
2021-08-30 10:13:48 +00:00
})();
</script>