2012-05-07 21 views
0

在我正在處理的頁面上,有一個div-id(dragZone),其中包含單獨的div-id,每個div-id都包含一個圖像 這些都是可拖動,可調整大小和點擊時轉發。從.resizable'img'函數中排除img文件

爲了讓.resizable工作,我填充了$('img')。可調整大小,但現在正在影響頁面上的所有其他圖像。

任何想法如何讓.resizable隻影響dragzone-id中的圖像文件?

$(document).ready(function() { 
var a = 3; 
$('#dragZone > div').draggable({ 
start: function(event, ui) 
{ $(this).css("z-index", a++); }}) 

$('img').resizable({maxHeight: 600, aspectRatio: true, animate: true }); 

$('#dragZone > div').click(function() { 
    $(this).addClass('top').removeClass('bottom'); 
    $(this).siblings().removeClass('top').addClass('bottom'); 
    $(this).css("z-index", a++); 

}); 
});  

回答

0

您還可以使用find方法裏面找dragZone圖像元素中:

$('#dragZone').find('img').resizable({maxHeight: 600, aspectRatio: true, animate: true }); 
0

變化

$('img').resizable({maxHeight: 600, aspectRatio: true, animate: true }); 

$('#dragZone img').resizable({maxHeight: 600, aspectRatio: true, animate: true }); 

這隻會得到IMG公司的dragZone DIV

+0

好的,那很尷尬。我確實嘗試過,但沒有奏效..現在它確實如此。謝謝! – user1379378

+0

沒問題,發生在我們身上!祝你好運! – Timm