2013-05-22 12 views
7

मैंने चारों ओर देखा है और हालांकि मुझे इस तरह के समान प्रश्न मिल गए हैं, उनमें से कोई भी मेरे लिए कोई समाधान नहीं था।JQuery UI - .resizable काम नहीं कर रहा

यहां एक और प्रश्न के समान लिंक है। Draggable and resizable in JqueryUI for an image is not working?

<html> 
<head> 
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> 
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script> 
</head> 
<body> 

<div id="draggableHelper" style="display:inline-block"> 
    <img id="image" src="http://www.google.com.br/images/srpr/logo3w.png" /> 
</div> 

<script type="text/javascript"> 

$(document).ready(function(){ 
$('#draggableHelper').draggable(); 
$('#image').resizable(); 

}); 
</script> 
</body> 
</html> 

यह सिर्फ एक बहुत ही बुनियादी उदाहरण है लेकिन जब मैं चलाने के लिए इस छवि चल है, लेकिन आकार बदलने योग्य नहीं है। हालांकि जहां तक ​​मैं कह सकता हूं, यह निश्चित रूप से काम करना चाहिए।

प्रश्न के निचले हिस्से में उपरोक्त लिंक में एक कामकाजी उदाहरण का एक लिंक है। http://jsfiddle.net/8VY52/ उदाहरण इस सटीक HTML और जावास्क्रिप्ट के साथ jfiddle का उपयोग कर रहा है।

क्या मुझे jquery UI के बारे में कुछ याद आ रहा है, यह जेफिल के माध्यम से क्यों काम करता है लेकिन उपरोक्त कोड में काम नहीं करता है।

धन्यवाद।

उत्तर

34

अपने कोड में jQuery-ui सीएसएस फ़ाइल याद कर रहे हैं

<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css"/> 

डेमो: Plunker

+1

आपका जवाब एक '/' में अंत लापता नहीं है? – luiscosta

0

यह आपके लिए काम करेगा।

<div id="draggableHelper" style="display:inline-block"> 
    <div id="image"><img src="http://www.google.com.br/images/srpr/logo3w.png" /></div> 
    </div> 
1

पूरा काम कर कोड होगा।

</head> 
<body> 

<div id="draggableHelper" style="display:inline-block"> 
    <div id="image"><img src="http://www.google.com.br/images/srpr/logo3w.png" /></div> 
    </div> 
<script type="text/javascript"> 

$(document).ready(function(){ 

$('#image').resizable(); 
$('#image').draggable(); 

$('#image').resize(function(){ 
    $(this).find("img").css("width","100%"); 
    $(this).find("img").css("height","100%"); 
}); 
}); 
</script> 

</body> 
</html> 
संबंधित मुद्दे