0
我想在同一網站上的兩個分開的div上使用fadeToggle
,但只有一個可以使用。我可以停用一個,然後另一個運行,但不能同時運行。 所以,如果用戶點擊comment-reply-btn
評論輸入字段應顯示,如果他點擊show-subcom-btn
評論應顯示。 我有這樣的標題:在一個網站上使用兩個淡入淡出
$(".comment-reply-btn").click(function(event){
event.preventDefault();
$(this).parent().next(".comment-reply").fadeToggle().delay(1000);
})
$(".show-subcom-btn").click(function(event){
event.preventDefault();
$(this).parent().next(".show-subcom").fadeToggle().delay(1000);
})
和這裏有兩個div我想顯示爲每次點擊。
<div class="show-subcom hhh2" style="display: none;" >
{% for child_comment in comment.children %}
<blockquote>
<img src="{{ child_comment.user.usersettings.profileimage.url }}" class="childcommentpic">
<a href="/profiles/{{child_comment.user}}">{{child_comment.user}}</a> <span>{{child_comment.timestamp}}</span><br>
<span>{{child_comment.content }}</span>
</blockquote>
{%endfor%}
</div>
<div class="comment-reply" style="display: none;">
<form method="POST" action=".">{%csrf_token%}
{{comment_form|crispy}}
<input type="hidden" value="{{ comment.id }}" name="parent_id">
<input type="submit" value="Reply" class="btn btn-default" name="">
</form>
</div>
如果它不與FadeToggle一起使用您還會推薦什麼來實現這種效果? 我在這裏或谷歌找不到任何東西。我發現的唯一的東西就像「在FadeToogles中顯示的那樣」或「當另一個人隱藏時顯示一個」等等。所以如果這個問題已經回答了,請給我發送鏈接。謝謝
您的按鈕在哪裏? – Huelfe