如何使用jquery与其他图像的拖动触发图像的拖动 [英] how to trigger dragging of image with drag of other image using jquery

查看:66
本文介绍了如何使用jquery与其他图像的拖动触发图像的拖动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jquery来拖动图像. 下面是我的代码

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],
        });

我的要求是,在拖动#imgMaster时,必须拖动#imgFrontLeft. 这两个图像都是独立拖动的. 请帮助我,我怎么能满足我的要求.

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.

推荐答案

看看这个小提琴链接,这将帮助您获得同步两个图像以进行拖动的答案. 您可以使用此

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.

这篇关于如何使用jquery与其他图像的拖动触发图像的拖动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆