0

jquery resizable is not working in my code, its only working when then image is directly loaded. Not working when image is added to a div

Here is my code:-

<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>

Help me out in this please

RecklessSergio
  • 806
  • 3
  • 10
  • 34

2 Answers2

1

to use jquery events for the elements which are not coming with the page loading we need to apply live.So here(in the above link i gave in the comment) they created event using live

see here using live event you can do

Community
  • 1
  • 1
PSR
  • 39,804
  • 41
  • 111
  • 151
0
$('.pic1').live('mouseover',function(){
    $(this).draggable();
});

This is working for me. Thanks

i understood what you have said. Many thanks

RecklessSergio
  • 806
  • 3
  • 10
  • 34