程序員,我有一個調整大小的問題。我用jquery爲了拖動divs並調整它們大小,但是在調整它們大小之後,img並沒有停留在它的初始位置,我嘗試了restyle改變它們屬性的所有標記,但是我沒有找到答案,我希望你能理解我的問題以及:)jquery和調整div一致性
收盤圖像:我無法發佈,因爲該網站政策
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</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.5/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script>
$(document).ready(function() {
$("#context").draggable();
$("#container").resizable({ alsoResize: ".border1" });
});
</script>
<style type="text/css">
.border{
-moz-border-radius-bottomleft: 5px;
-moz-border-radius-bottomright: 5px;
-webkit-border-bottom-left-radius: 5px;
-webkit-border-bottom-right-radius: 5px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
-webkit-border-top-left-radius: 5px;
-webkit-border-top-right-radius: 5px;
}
.border1{
-moz-border-radius-bottomleft: 3px;
-moz-border-radius-bottomright: 3px;
-webkit-border-bottom-left-radius: 3px;
-webkit-border-bottom-right-radius: 3px;
-moz-border-radius-topleft: 3px;
-moz-border-radius-topright: 3px;
-webkit-border-top-left-radius: 3px;
-webkit-border-top-right-radius: 3px;
background-color:White; border-style:solid; border-width:1px; border-color: Black;
}
div.shadow {
text-align:center;
padding-top:0px;
background-color: Gray;
border: 1px solid :#336699;
width:13px; height:13px;
margin-top:3px;
margin-left:242px;
}
</style>
</head>
<body id="p">
<div id="context" style="margin-left:500px; margin-top:100px;width:260px; " >
<!--
-->
<div id="container" class="border" style=" padding-top:1px;background-color:#336699 ; width:260px; height:195px; ">
<div class="shadow" style=" position:relative; padding:0px 0px 0px 0px">
<img id="img" style=" margin-right:auto;margin-left:auto;position: absolute; margin-top:0px; margin-bottom:0px" src="close.png" value="Remove Element" onClick="removeElement('p','context');" />
</div>
<div class="border1" style=" width:253px; height:167px; margin-top:8px ; margin-left:3px ;visibility:visible"></div>
</div>
</div>
<script type="text/javascript">
function show() {
document.getElementById('container').style.visibility = 'visible';
}
function hide() {
document.getElementById('container').style.visibility = 'hidden';
}
function removeElement(parentDiv, childDiv) {
var child = document.getElementById(childDiv);
var parent = document.getElementById(parentDiv);
parent.removeChild(child);
}
</script>
</body>
</html>
發佈IMG的src和有足夠聲譽的人(像我一樣)會將其編輯到您的帖子中。 – Kyle 2011-03-22 11:29:27