我试图在点击图像后显示带有内容的div,但是当我的页面被加载后,我尝试点击,则没有任何反应。有趣的是,如果我的页面正在加载不隐藏的内容,然后我会隐藏()和show()id控制台后,它完美的作品。我究竟做错了什么?jQuery show()在hide()后不工作()
$(document).ready(function() {
$('.content-flowers').hide()
var first = $(".content-flowers").children()[0];
var second = $(".content-flowers").children()[1];
var third = $(".content-flowers").children()[2];
var firstImg = $(".flower-image")[0];
var secondImg = $(".flower-image")[1];
var thirdImg = $(".flower-image")[2];
$(firstImg).click(function(){
$(first).toggle(1000);
})
/*$(".flower-image").click(function() {
$('.content-flowers').show(1000);
});*/
});
最新评论功能工作也不错,但函数加载所有三个的div的内容,我想以点击1张图像后内容的第一个div将显示
发表一个[mcve]请 – j08691
向我们显示HTML,所以我们可以尝试 –