Fix animate bug.
This commit is contained in:
parent
22f3b9dafb
commit
4ee60d65f7
|
|
@ -3,35 +3,28 @@
|
||||||
<li>{{content}}</li>
|
<li>{{content}}</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
(function(){
|
(function(){
|
||||||
var main_div = $("div[data-subpart-id={{subpart-id}}]"),
|
var main_div = $("div[data-subpart-id={{subpart-id}}]"),
|
||||||
total_texts = main_div.find("ul li").length - 1,
|
total_texts = main_div.find("ul li").length - 1,
|
||||||
current_text = 0,
|
current_text = 0,
|
||||||
last_text = 0;
|
last_text = 0;
|
||||||
|
|
||||||
main_div.find("ul li").hide();
|
main_div.find("ul li").hide();
|
||||||
var textTransform = function(){
|
function textTransform(){
|
||||||
current_text++;
|
|
||||||
current_text = (current_text > total_texts ? 0 : current_text);
|
current_text = (current_text > total_texts ? 0 : current_text);
|
||||||
last_text = (current_text == 0 ? total_texts : current_text - 1);
|
last_text = (current_text == 0 ? total_texts : current_text - 1);
|
||||||
speed = $('.marquee > li > a').eq(current_text).attr('speed');
|
speed = main_div.find("ul li > a").eq(0).attr('speed');
|
||||||
main_div.find("ul li").eq(last_text).slideUp(500);
|
main_div.find("ul li").eq(last_text).slideUp({duration: 500, queue: true});
|
||||||
main_div.find("ul li").eq(current_text).slideDown(500);
|
main_div.find("ul li").eq(current_text).slideDown({duration: 500, queue: true});
|
||||||
|
current_text++;
|
||||||
if(total_texts > 0){
|
if(total_texts > 0){
|
||||||
setTimeout(textTransform,speed);
|
if(window["{{subpart-id}}_time_out_id"])
|
||||||
|
clearTimeout(window["{{subpart-id}}_time_out_id"]);
|
||||||
|
window["{{subpart-id}}_time_out_id"] = setTimeout(textTransform,speed);
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
setTimeout(textTransform,500);
|
textTransform();
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
(function(){
|
|
||||||
var main_div = $("div[data-subpart-id={{subpart-id}}]")
|
|
||||||
})()
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue