2012-09-17 77 views
0

你好,我有一個jQuery僅在瀏覽器中可見區域打開圖片:jQuery的功能出現的圖像

$(document).ready(function() { 
    $('det_img_^').appear(function() { 
    var a = $(this).find('a'); 
    $(this).html('<img src="' + a.attr('href') + '" title="' + a.text() + '" />'); 
    }); 
}); 

HTML代碼應該是:

<img class=" " id="det_img_54837261" 
src="http://site.com/image54837261.jpg" 
alt="" title="" border="0" height="190"> 

代碼不能正常工作,需要修復jQuery部分使用這個HTML代碼。我嘗試了一個原始示例http://code.google.com/p/jquery-appear/wiki/Examples它爲我工作得很好。 JS文件全部包括在內。 謝謝你們!

+0

你有沒有包括這裏麪包含js文件出現..?因爲出現不是傳統的jquery功能 – coolguy

+0

這段代碼適合你或不。清楚解釋。 –

回答

3

您是否嘗試過使用#作爲ID選擇器?

$('#det_img_^').appear(function() {

$('img#det_img_^').appear(function() {

+0

我添加了代碼,但當我滾動到DIV時,我的顯示沒有顯示出來。我收到一個錯誤'elements [i] .appear'不是函數 – Si8

+0

jquery顯示是一個單獨的插件:https://github.com/morr/jquery.appear –