[英]remove jquery css on click
I've got an image on my site, and everytime I click on that, it slides open a box with 4 links. 我的网站上有一张图片,每次单击该图片时,它会滑动打开一个带有4个链接的框。 The image starts at 0.6 opacity, and when you click on it to open the box, gets opacity 1. However I would like that when you close the box, the opacity goes back to 0.6. 图像以0.6的不透明度开始,当您单击它以打开框时,它的不透明度为1。但是我希望当您关闭框时,不透明度回到0.6。
My code is: 我的代码是:
jQuery(document).ready(function() {
jQuery('.toggle_hide').hide();
jQuery(".moduletable span").css('cursor', 'pointer').click(function() {
var $this = $(this);
$this.css({
opacity: '1'
});
$('.toggle_hide').not($this.next("div")).fadeOut(300);
$this.next("div").slideToggle(300);
});
});
Hope you can help me out. 希望你能帮助我。
Best regards, Martin 最好的问候,马丁
Simply add a callback function on your fadeOut()
to set the opacity back to 0.6 after the animation has completed: 只需在您的fadeOut()
上添加一个回调函数 ,即可在动画完成后将不透明度设置回0.6:
$('.toggle_hide').not($this.next("div")).fadeOut(300, function() {
$this.css({opacity:'0.6'});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.