0

私が取り組んでいるページには、それぞれが 1 つの画像を含む個別の div-id を含む div-id (dragZone) があり、これらはすべてドラッグ可能で、サイズ変更可能で、クリックすると前方に表示されます。

.resizable を機能させるために、 $('img').resizable を入力しましたが、これはもちろん、ページ上の他のすべての画像に影響を与えています。

dragzone-id にある画像ファイルにのみ影響を与えるように .resizable を作成する方法はありますか?

$(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++);

});
});    
4

2 に答える 2

0

変化する

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

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

これは、dragZone div 内の img のみを取得します

于 2012-05-07T21:08:40.837 に答える
0

findメソッドを使用して、内部の画像要素を見つけることもできますdragZone

$('#dragZone').find('img').resizable({maxHeight: 600, aspectRatio: true, animate: true });
于 2012-05-07T21:10:20.477 に答える