嗨我有這樣的代碼jQuery的.Hover問題與阿賈克斯
cuts_html = '';
for(i = 0; i < attachments.length; i++) {
fburl3 = site_url + '/haircut-detail/?img_id=' + attachments[i].ID + '&uid=' + attachments[i].post_author;
if(isNaN(attachments[i].view_count)) attachments[i].view_count = 0;
cuts_html += '<div id="controller-image" class="cut-image">';
cuts_html += '<div id="cut-imageplacer">';
cuts_html += '<div class="cut-image-info">' +
'By <a href="' + user_profile_url +
'&user_id=' + attachments[i].post_author + '">' +
attachments[i].author_name + '</a>' +
'</div>';
cuts_html += '<div class="commentbox-1">' +
'<img src="https://d2xcq4qphg1ge9.cloudfront.net/assets/17276/435546/original_views.png"> ' +
attachments[i].view_count +
' <img src="https://d2xcq4qphg1ge9.cloudfront.net/assets/17276/435545/original_talk-bubble.png"> ' +
'<fb:comments-count href="' + fburl3 + '"></fb:comments-count>' +
'</div></div>';
cuts_html += '<a class="cut-image-a" ' +
'href="' + image_detail_url +
'?uid=' + attachments[i].post_author +
'&img_id=' + attachments[i].ID + '">' +
attachments[i].attachment_image_html + '</a>';
cuts_html += '</div>';
}
股利編號cut-imageplacer
是display:none
,所以我要的是,當有人徘徊在controller-image
DIV中,cut-imageplacer
顯示,當然不用時隱藏的上。我使用此代碼
<script type="text/javascript">$(document).ready(function(){ $('.cut-image').hover(
function(){ $('#cut-imageplacer').show();
}, function() { $('#cut-imageplacer').hide(); }); }); </script>
但它不工作......任何想法我做錯了什麼?或者指出我正確的方向?
我甚至用在DIV $(本)。兒童,但沒有工作,要麼在那裏被定義 –
'attachments'?你能把它包含在你的代碼中嗎? –
提示:這可以更容易地與純CSS – Bergi