使用 jQuery 缓动的 Javascript 集成
我正在努力使这段代码工作,基本上我有这一段代码:
<script type="text/javascript" src="jquery-easing.js"></script>
<script type="text/javascript">
$(document).ready(function(){
hidden = true;
$(".btn-slide").click(function () {
if(hidden == false) {
$("#photodisplay").slideUp(1000, method, callback);
$("#gallery").slideDown(1000, method, callback);
hidden = true;
} else {
$("#photodisplay").slideUp(1000, method, callback);
$("#gallery").slideDown(1000, method, callback);
hidden = false;
}
});
});
</script>
当使用slideUp和“慢”在Javascript中正常编写时,效果很好,但我只想包括缓动,因为目前它有点静态。 我该如何调整它才能使 jQuery 正常工作?任何帮助都会很棒,提前致谢,
索菲
I'm struggling to make this code work, basically I have this section of code:
<script type="text/javascript" src="jquery-easing.js"></script>
<script type="text/javascript">
$(document).ready(function(){
hidden = true;
$(".btn-slide").click(function () {
if(hidden == false) {
$("#photodisplay").slideUp(1000, method, callback);
$("#gallery").slideDown(1000, method, callback);
hidden = true;
} else {
$("#photodisplay").slideUp(1000, method, callback);
$("#gallery").slideDown(1000, method, callback);
hidden = false;
}
});
});
</script>
This when written normally in Javascript using the slideUp and 'slow' works fine but I just want to include the easing as at the moment it's a bit static.
How can I adjust this so that the jQuery works? Any help would be great, thanks in advance,
Sofi
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定你的意思,但lideUp和slideDown有三个参数。
所以你可以做的是:
除了使用隐藏变量之外,你还可以使用以下方法检查选择器是否可见:
I'm not sure what you mean but slideUp and slideDown have three parameters.
So what you can do is:
And instead of using the hidden variable you could also check whether or not the selector is visible using: