【发布时间】:2013-04-01 12:08:20
【问题描述】:
我在实现一个本应“简单”的插件时遇到了问题。插件在这个地址:http://lab.smashup.it/flip/
我尝试用一个简单的短代码对其进行测试,并检查了显示插件的页面中的代码,以确保我做对了,但显然什么也没发生,而且我没有收到任何错误反馈,所以我没有不知道往哪个方向走。
这是我测试运行它的代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Test#0935</title>
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
// Load jQuery
google.load("jquery", "1");
</script>
<script src="JS/jquery-ui-1.7.2.custom.min.js"></script>
<script src="JS/jquery.flip.min.js"></script>
<script type="text/javascript">
$("a").bind("click",function(){
$("#flipo").flip({
direction: "tb"
})
return false;
});
</script>
<style type="text/css">
#flipo {
width:100px;
height:70px;
background-color:lightblue;
margin:20px;
}
</style>
</head>
<body>
<div id="flipo"></div>
<a href="#" id="left">left</a>
</body>
</html>
我为 jQuery 库“导入”了与插件作者所做的相同的源,并且我确保对插件的引用是正确的。
查看作者页面的源代码,您会看到他也在链接标签上“绑定”了一个点击功能,从他的插件中调用 .flip 方法,“tb”表示“向左翻转”。
【问题讨论】:
-
哎呀,
bind()!这些天应该使用.on()。 -
谢谢!我会记下来的。我对很多事情还是陌生的 x)