1

我正在开发一个 html5 远程信息处理应用程序。我的要求是我有一个主窗口,并且在拖动(打开/关闭)时,其他窗口应该被拖动(打开/关闭)。请帮助我知道如何做到这一点。下面是我的代码

      var div_FrontRight= $('<div/>', { id: 'FrontLeft'});
      var div_FrontLeft= $('<div/>', { id: 'FrontLeft'});
       var div_Master= $('<div/>', { id: 'Master'});
       var div_RearRight= $('<div/>', { id: 'RearRight'});
       var div_RearLeft= $('<div/>', { id: 'RearLeft'});


       $("#AnimationWindow").append(div_FrontLeft);
       $("#AnimationWindow").append(div_Master);
       $("#AnimationWindow").append(div_RearRight);
       $("#AnimationWindow").append(div_RearLeft);


       var img_FrontLeft= $('<img/>', { id: 'imgFrontLeft', src:'../images/car.jpg'});
       var img_Master= $('<img/>', { id: 'imgMaster', src:'../images/car.jpg'});
       var img_RearRight= $('<img/>', { id: 'imgRearRight', src:'../images/car.jpg'});
       var img_RearLeft= $('<img/>', { id: 'imgRearLeft', src:'../images/car.jpg'});



       $("#FrontLeft").append(img_FrontLeft);
       $("#Master").append(img_Master);
       $("#RearRight").append(img_RearRight);
       $("#RearLeft").append(img_RearLeft);

       var div_stop= $('<div/>', { id: 'stop'});
       $("#AnimationWindow").append(div_stop);


       $( "#imgFrontLeft" ). draggable
({ 
    axis: "y" ,
    containment:[0,152,0,290] 
});
       $( "#imgMaster" ). draggable
({ 
    axis: "y", 
    containment:[0,158,0,430] 

});
       $( "#imgRearRight" ). draggable
({ 
    axis: "y",
    containment:[0,337,0,470
});
       $( "#imgRearLeft" ). draggable
({ 
    axis: "y", 
    containment:[0,337, 0,470] 
 });

单独拖动单个图像。但我的要求是,在Master的拖动中,其他4个窗口也应该被拖动。这可能吗 ?如果是,那么请提供同样的帮助。

提前致谢 !!

4

1 回答 1

0

尝试这个

   var div_FrontRight= $('<div/>', { id: 'FrontLeft'});
   var div_FrontLeft= $('<div/>', { id: 'FrontLeft'});
   var div_Master= $('<div/>', { id: 'Master'});
   var div_RearRight= $('<div/>', { id: 'RearRight'});
   var div_RearLeft= $('<div/>', { id: 'RearLeft'});


   $("#AnimationWindow").append(div_FrontLeft);
   $("#AnimationWindow").append(div_Master);
   $("#AnimationWindow").append(div_RearRight);
   $("#AnimationWindow").append(div_RearLeft);


   var img_FrontLeft= $('<img/>', { id: 'imgFrontLeft', src:'../images/car.jpg'});
   var img_Master= $('<img/>', { id: 'imgMaster', src:'../images/car.jpg'});
   var img_RearRight= $('<img/>', { id: 'imgRearRight', src:'../images/car.jpg'});
   var img_RearLeft= $('<img/>', { id: 'imgRearLeft', src:'../images/car.jpg'});



   $("#FrontLeft").append(img_FrontLeft).children(img_FrontLeft).draggable
   ({ 
        axis: "y" ,
        containment:[0,152,0,290] 
   });
   $("#Master").append(img_Master).children(img_Master).draggable
   ({ 
        axis: "y",
        containment:[0,337,0,470]
   });
   $("#RearRight").append(img_RearRight).children(img_RearRight).draggable
   ({ 
        axis: "y",
        containment:[0,337,0,470]
   });
   $("#RearLeft").append(img_RearLeft).children(img_RearLeft).draggable
   ({ 
        axis: "y", 
        containment:[0,337, 0,470] 
   });

   var div_stop= $('<div/>', { id: 'stop'});
   $("#AnimationWindow").append(div_stop);
于 2013-02-08T07:41:21.637 回答