0
嘿,大家我再次有腳本問題。我正在爲post中的成員個人資料數據做一個jQuery顯示/隱藏。請訪問http://www.pimpkings.com/t3-what-up-everyone查看我在說什麼,我將代碼保留下來,以便您可以看到它在做什麼。jquery隱藏/顯示搞砸
每當我點擊一個人顯示/隱藏它打開每個人,我只希望它打開1人在用戶請求。
代碼爲─
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".slidingDiv").hide();
$(".show_hide").show();
$('.show_hide').click(function(){
$(".slidingDiv").slideToggle();
});
});
</script>
然後將HTML編碼是
<span class="show_hide" style="cursor:pointer;color:#c0c0c0;">Show/hide</span>
<div class="slidingDiv">
<!-- BEGIN profile_field -->
<center> {postrow.displayed.profile_field.LABEL} <center/>
<center> {postrow.displayed.profile_field.CONTENT} <center/>
<center> {postrow.displayed.profile_field.SEPARATOR}<center/>
<!-- END profile_field -->
<center>{postrow.displayed.profile_field.LABEL}<center/>
<center>Online Status<center/><br/>
<center>{postrow.displayed.ONLINE_IMG}<center/>
{postrow.displayed.POSTER_RPG} <br />
<!-- BEGIN contact_field -->
<br/> <br/>
{postrow.displayed.PROFILE_IMG} {postrow.displayed.PM_IMG}
{postrow.displayed.EMAIL_IMG} {postrow.displayed.contact_field.CONTENT}
<!-- END contact_field -->
<span class="show_hide" style="cursor:pointer;color:#c0c0c0;">hide</span></div>
</span>
誰能幫助找出另一種選擇,因此不會立刻打開所有?
哈哈
謝謝你,它的工作原理。我會喜歡這個,但不能。你能否解釋一下這種奇妙的運作方式?是$(this).next是什麼創建它來一次打開一個? –
是的,這是指被點擊的元素,所以其他代碼是相對於該特定元素而不是具有某個類的所有元素。 – j08691