jQuery animate 의 예제 코드가 있는데, div를 사용하면 div가 넓어 지므로 시간에 따라 카운터를 기반으로 자동으로 div를 확장하고 싶습니다. . 당신은에 의해 상대 애니메이션을 사용할 수 있습니다div 또는 span이 동적으로/지속적으로 너비를 변경합니다.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy for Windows (vers 14 February 2006), see www.w3.org">
<style type="text/css">
div {
background-color:#bca;width:100px;border:1px solid green;
}
</style>
<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript">
</script>
<title></title>
</head>
<body>
<button id="go">» Run</button>
<div id="block">
Hello!
</div>
<script type="text/javascript">
var someWidth = "70%";
/* Using multiple unit types within one animation. */
$("#go").click(function(){ $("#block").animate({ width: someWidth, opacity: 0.4, marginLeft: "0.6in", fontSize: "3em", borderWidth: "10px" }, 1500);});
</script>
</body>
</html>
좋은 출발을 보였습니다. 찾고있는 솔루션으로 이동하려고 시도한 내용에 대한 연구 나 다른 코드가 있습니까? –