我在我的网站上有一张图片,每次我点击它,它就会滑动打开一个有4个链接的框。图像从0.6不透明度开始,当你点击它打开盒子时,得到不透明度1。然而,我希望当你关闭盒子时,不透明度回到0.6。
我的代码是:
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);
});
});
希望你能帮帮我。
致以最好的问候,马丁
发布于 2013-10-15 18:23:59
只需在fadeOut()
上添加一个callback function,即可在动画完成后将不透明度设置回0.6:
$('.toggle_hide').not($this.next("div")).fadeOut(300, function() {
$this.css({opacity:'0.6'});
});
https://stackoverflow.com/questions/19378739
复制相似问题