我是jQuery语法的新手,这可能是一个真正的noobie问题....但我只是不明白为什么我只是在加载此页面时收到错误“$ .effects is undefined”。如果有人能看到这一点,我会非常感激...... TIA,rixter
<!doctype html>
<html>
<head>
<script type="text/javascript" src="jquery-1.7.1.min.js"></script>
<script src="./development-bundle/ui/jquery.ui.core.js"></script>
<script src="./development-bundle/ui/jquery.effects.pulsate.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("a").click(function(event){
//alert("Thanks for visiting!");
});
});
function runEffect() {
$("pulsate").effect( selectedEffect, options, 500, callback );
}
// bind button to click event
$( "#button" ).click(function() {
alert("Running effect...");
runEffect();
return false;
});
// callback function to bring a hidden box back
function callback() {
setTimeout(function() {
$( "#effect" ).removeAttr( "style" ).hide().fadeIn();
}, 1000 );
};
</script>
</head>
<body>
<a href="http://jquery.com/">jQuery</a>
<div id=effect>
Show effects here...
</div>
<a href="#" id="button" class="ui-state-default ui-corner-all">Run Effect</a>
</body>
</html>
答案 0 :(得分:5)
您还需要加载
./发展束/ UI / jquery.effects.core.js
如果您刚刚开始我会建议只加载完整版本的jQuery UI而不是单独的开发包文件。即使您知道它应该如何工作,手动计算出依赖性也是一种痛苦。
答案 1 :(得分:2)
我相信$.effects
是jQuery UI的一部分,它不包含在核心jQuery包中。见http://jqueryui.com/docs/Effects/Methods
您可以在the jQuery UI site上自定义和下载jQuery UI包,然后在jQuery之后将其包含在单独的<script>
标记中。
答案 2 :(得分:1)
Plusate效果按以下方式完成....
$(this).effect("pulsate", { times:3 }, 2000);
其中'this'是你的div id或class ....更多信息: