1
我有一個div
與背景圖像,我允許用戶使用Jquery UI's resizable
函數重新調整div
。我希望當用戶調整div
的大小時,背景圖片就會縮放。但是這並沒有發生。有沒有簡單的方法來解決這個問題?jquery ui resizable rescale background-image
我發現了一些其他的例子,他們在div
裏面使用了一個<img>
標籤。但我真的想用CSS來做背景圖片。
HTML:
<div id="container">
<div id="settingsWidget" class="SarahComponent">
</div>
</div>
CSS:
.SarahComponent {
width:68px;
height:68px;
}
#settingsWidget {
background: URL('../../img/advancedsettings.png') no-repeat;
padding:40px;
}
JS:
$("#settingsWidget").resizable({
start: function (event, ui) {
$(this).css("border", "1px solid red");
},
stop: function (event, ui) {
$(this).css("border", "");
}
});
$("#settingsWidget").draggable({ cursor: "move" });
作品就像我需要它的工作。乾杯! – Reinard
不客氣:) – Yass