我已经在论坛中搜索过了,但是我找不到任何方法来解决我在jQuery中的"effect“功能的问题。
我在代码中准确地得到了错误TypeError: $(...).effect is not a function:
$('div.step').removeClass('active');
$("div.step").effect('slide', {direction: 'right', mode: 'hide'}, 500);
$('#step' + step + '').addClass('active');
$('#step' + step + '').effect('slide', {direction: 'right', mode: 'show'}, 500);我在<head></head>中包含了jQuery和jQuery UI,如下所示:
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>但是徒劳无功,你有什么想法吗?谢谢
发布于 2014-02-24 22:52:46
您需要将自定义脚本放在jQuery和jQuery UI声明之后,并将其包装在文档ready()函数中:
<body>
...
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<script type="text/javascript">
$(document).ready(function() {
...
});
</script>
</body>发布于 2016-04-06 17:06:19
我不知道问题是否解决了,但我找到了一种方法来复制摇动功能和动画功能,它的工作方式就像一个护身符:
function shake() {
var div = document.getElementById('yourElementID');
var interval = 100;
var distance = 10;
var times = 4;
$(div).css('position', 'relative');
for (var iter = 0; iter < (times + 1) ; iter++) {
$(div).animate({
left: ((iter % 2 == 0 ? distance : distance * -1))
}, interval);
}
$(div).animate({ left: 0 }, interval);
}
这个解决方案属于thisSite,所有的功劳都归功于他们。我希望这将在未来对某些人有用,如果是这样,请将其标记为解决方案,问候。
发布于 2019-06-05 09:21:38
添加jQueryUI,而不仅仅是jQuery。jQuery不包含effect()函数:https://code.jquery.com/ui
https://stackoverflow.com/questions/21991062
复制相似问题