无法让jqueryrotate工作 [英] Having trouble getting jqueryrotate to work
本文介绍了无法让jqueryrotate工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我没有运气在这个页面上获得jqueryrotate示例#2在一个简单的HTML页面上工作。我究竟做错了什么?感谢您的帮助。
I am not having any luck getting jqueryrotate example #2 on this page to work on a simple html page. What am I doing wrong? Thanks for the help.
这是我的代码 -
<!DOCTYPE html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="http://jqueryrotate.googlecode.com/svn/trunk/jQueryRotate.js"></script>
<STYLE type="text/css">
#img { margin:100px 100px;}
</STYLE>
</head>
<body>
<script type="text/javascript">
$("#img").rotate({
bind:
{
mouseover : function() {
$(this).rotate({animateTo:180})
},
mouseout : function() {
$(this).rotate({animateTo:0})
}
}
});
</script>
<img id="img" src="https://www.google.com/images/srpr/logo3w.png">
</body>
</html>
推荐答案
您的代码工作正常,请参阅这里。
you code works just fine, see here.
您应该使用准备好了。
$(document).ready(function() {
$("#img").rotate({
bind: {
mouseover: function() {
$(this).rotate({
animateTo: 180
})
},
mouseout: function() {
$(this).rotate({
animateTo: 0
})
}
}
});
});
此外,我不建议使用id #img
这不是它的错,它只是一种丑陋的IMO。
Also, I would not recommend using the id #img
it's not that it's wrong, it's just sort of ugly IMO.
这篇关于无法让jqueryrotate工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文