0

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.

swati
  • 129
  • 1
  • 18

1 Answers1

3

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.

Karthi Keyan
  • 4,243
  • 5
  • 24
  • 47