0

jquery resizable 在我的代码中不起作用,它仅 在直接加载图像 时才起作用。 将图像添加到 div 时不起作用

这是我的代码:-

<html lang="en">
<head>
<title>Outfit Demo</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"></script>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/base/jquery-ui.css"/>
<script type="text/javascript">
jQuery(document).ready(function(event){
   jQuery(".pic1").draggable();
   jQuery(".pic1").resizable();
});
  function select(src)
  {
  path = "<img class=\"pic1\" src=\""+src+"\" height=\"300px\" width=\"300px\"/>";
  document.getElementById("image").innerHTML=path;
  }
  </script>
</head>

<body>
<div id="leftpanel" style="position:absolute;left:0;width:50%;">
<div style="left:0;height:30%;" id="image"></div>
</div> 
<div id="middlepanel" style="width: 100%; height: 100%; position:absolute;left:500;width:50%;">
<img class="pic1" src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcT-cYNnwQZF6R0T5v11nnXOmdWWEGj4Tf7tKMhbB_FsNFo8yLmaeg" height="300px" width="700px" onclick="select(this.src)"/>
</div> S
</body>
</html>

请帮帮我

4

2 回答 2

1

要对页面加载不附带的元素使用 jquery 事件,我们需要实时应用。所以在这里(在上面我在评论中给出的链接中)他们使用实时创建事件

看到这里使用你可以做的现场活动

于 2013-02-25T11:50:26.543 回答
0
$('.pic1').live('mouseover',function(){
    $(this).draggable();
});

这对我有用。谢谢

我明白你所说的。非常感谢

于 2013-02-25T11:54:52.720 回答