Как сделать drag-n-drop и изменить размер изображения с помощью jQuery? - PullRequest
2 голосов
/ 24 апреля 2010

Как изменить размер и изображение с помощью jQuery, но сохранить его соотношение сторон одинаковым?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>CrossSlide - A jQuery plugin to create pan and cross-fade animations</title>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>

</head>
<body>

<style type="text/css">
#resizebleImage { background: silver; }

</style>

<script type="text/javascript">

$(document).ready(function(){
 $("#resizebleImage").resizable().parent().draggable();  
  });
</script>

<img id="resizebleImage"  src="http://images.askmen.com/galleries/singer/gloria-estefan/pictures/gloria-estefan-picture-4.jpg">
</body>
</html>

Ответы [ 2 ]

1 голос
/ 03 февраля 2011

Вы можете сделать это, используя свойство 'tooResize'.

draggable.resizable({alsoResize:'#image'});
draggable.draggable();

draggable является элементом div, а изображение вставляется в div.

1 голос
/ 24 апреля 2010

ОН ... хе ... Соотношение: правда,

...