问题
I am working with jquery for dragging of images. Below is my code
$( "#imgMaster" ). draggable
({
axis: "y",
containment:[0,170,0,430],
start: function(event, ui)
{
$("#imgFrontLeft").trigger('draggable');
}
});
$( "#imgFrontLeft" ). draggable
({
axis: "y" ,
containment:[0,162,0,290],
});
My requirement is that, on drag of #imgMaster, #imgFrontLeft must be dragged. Both the images are dragged independently. Kindly help me with , how could i meet my requirement.
回答1:
Take a look this Fiddle link this will help you to get the answer for synchronizing two images for dragging. you can use this
$("#imgFrontLeft").css('left',ui.position.left);
$("#imgFrontLeft").css('top',ui.position.top);
in your code to drag the images, i hope this will help you more.
来源:https://stackoverflow.com/questions/14809283/how-to-trigger-dragging-of-image-with-drag-of-other-image-using-jquery