jQuery 动画切换
我正在尝试创建如下所示的动画效果。
// JavaScript Document
$(document).ready(function () {
$('.lovebtn').click(function () {
$('.love').animate({
height: '672px'
}, 1000, function () {
$('.lovetxt').css("display", "block");
$(".lovebtn .button").attr("src", "images/btn_love_close.gif");
});
});
// Lust
$('.lustbtn').click(function () {
$('.lust').animate({
height: '672px'
}, 1000, function () {
$('.lusttxt').css("display", "block");
$(".lustbtn .button").attr("src", "images/btn_lust_close.gif");
});
});
//luxuary
// Lust
$('.luxurybtn').click(function () {
$('.maskbg').css("display", "block");
$('.luxury').animate({
height: '1056px'
}, 1000, function () {
$('.luxurytxt').css("display", "block");
$(".luxurybtn .button").attr("src", "images/btn_luxury_close.gif");
});
});
});
http://uniquedl.com/3closets/index.html
当您进入上述页面并单击爱情欲望和奢侈上的三个按钮。你会得到一系列的效果。当我单击同一个按钮时,我不想反转效果。
有什么建议我该怎么做吗?
I am trying to create an animate effect like the following.
// JavaScript Document
$(document).ready(function () {
$('.lovebtn').click(function () {
$('.love').animate({
height: '672px'
}, 1000, function () {
$('.lovetxt').css("display", "block");
$(".lovebtn .button").attr("src", "images/btn_love_close.gif");
});
});
// Lust
$('.lustbtn').click(function () {
$('.lust').animate({
height: '672px'
}, 1000, function () {
$('.lusttxt').css("display", "block");
$(".lustbtn .button").attr("src", "images/btn_lust_close.gif");
});
});
//luxuary
// Lust
$('.luxurybtn').click(function () {
$('.maskbg').css("display", "block");
$('.luxury').animate({
height: '1056px'
}, 1000, function () {
$('.luxurytxt').css("display", "block");
$(".luxurybtn .button").attr("src", "images/btn_luxury_close.gif");
});
});
});
http://uniquedl.com/3closets/index.html
when you go the the ablove page and click the three buttons on either love lust and luxury. you get a series of effects. when i click the same button i wannt reverse the effect .
any tips how i can do it ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我只会为爱按钮显示几乎相同的其他只是不同的高度和CSS选择器当然
抱歉我在将代码放在正确的布局中时遇到问题:(你可以在这里检查http://jsfiddle.net/dKyku/
基本上,单击链接即可在两部分代码之间切换,一部分显示该部分,第二部分隐藏它/将其放回原始布局。
I will show only for the love buttonm almost the same for other just different height and CSS selectors of course
Sorry I have problems putting the code in right layout :( You could check it here http://jsfiddle.net/dKyku/
Basically on clicking the link you toggle between two portions of code, one showing the section, and second one hiding it/putting it back to its original layout.
您还可以通过添加额外的类来做到这一点,如下所示
You can also do this by adding extra class like this
插入一个布尔值,如下所示:
Insert a boolean value, like this: