如何使用jqery自动旋转一个div [英] How to auto rotate one div using jqery
本文介绍了如何使用jqery自动旋转一个div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用jqery自动旋转一个div。我有一个脚本,这个用法只是从下到上滚动。它不会旋转。
< script type = text / javascript src = http://ajax.googleapis.com/ajax/libs/jquery /1.8.3/jquery.min.js\"> < / script >
< < span class =code-leadattribute> script type = text / javascript >
$(function(){
var interval = setInterval(function(){
if($(#div1)。scrollTop()!= $('#div1')[0] .scrollHeight){
$(#div1)。scrollTop($( #div1)。scrollTop()+ 10);
} else {
clearInterval(interval);
}
},1000);
});
< / script
< div id = div1 style = height:60px; width:100%; border:1px solid #ccc; overflow:auto > >
< / div >
解决方案
(function(){
var interval = setInterval(function(){
if(
(#div1)。scrollTop()!=
('#div1')[0] .scrollHeight){
How to auto rotate one div using jqery . I have one script this use to only scrolling from bottom to top .it will not agian rotate.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type = "text/javascript">
$(function () {
var interval = setInterval(function () {
if ($("#div1").scrollTop() != $('#div1')[0].scrollHeight) {
$("#div1").scrollTop($("#div1").scrollTop() + 10);
} else {
clearInterval(interval);
}
}, 1000);
});
</script
<div id="div1" style="height:60px;width:100%;border:1px solid #ccc;overflow:auto">>
</div>
解决方案
(function () { var interval = setInterval(function () { if (
("#div1").scrollTop() !=
('#div1')[0].scrollHeight) {
这篇关于如何使用jqery自动旋转一个div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文