답변 2개 / 댓글 7개
채택된 답변
+20 포인트
<script type="text/javascript">
$(function() {
$("#test").focus(function() {
$(this).animate({width:"300px"}, 1000);
}).blur(function() {
$(this).animate({width:"200px"}, 1000);
});
});
</script>
<input type="text" name="test" id="test" style="width:200px; border:1px solid #ccc" />
대충 이런 식으로 하면 되지 않을까 싶네요.
답변에 대한 댓글 6개
답변 고맙습니다. 근데, 아래처럼 해봤는데, 안 되네요.
브라우저 창 너비가 일정px 이하 일 때만 작동되게 하려고 그러거든요.
모바일이라든가 태블릿이라든가....
<script type="text/javascript">
$(function() {
f($(document).width() < 1000) {
$("#test").focus(function() {
$(this).animate({width:"250px"}, 1000);
}).blur(function() {
$(this).animate({width:"70px"}, 1000);
});
});
});
</script>
위처럼 해봐도, 또 아래처럼 해봐도 안 되네요.
<script type="text/javascript">
f($(document).width() < 1000) {
$(function() {
$("#test").focus(function() {
$(this).animate({width:"250px"}, 1000);
}).blur(function() {
$(this).animate({width:"70px"}, 1000);
});
});
});
</script>
어떤 식으로 위 소스를 추가해야 하는지요?
브라우저 창 너비가 일정px 이하 일 때만 작동되게 하려고 그러거든요.
모바일이라든가 태블릿이라든가....
<script type="text/javascript">
$(function() {
f($(document).width() < 1000) {
$("#test").focus(function() {
$(this).animate({width:"250px"}, 1000);
}).blur(function() {
$(this).animate({width:"70px"}, 1000);
});
});
});
</script>
위처럼 해봐도, 또 아래처럼 해봐도 안 되네요.
<script type="text/javascript">
f($(document).width() < 1000) {
$(function() {
$("#test").focus(function() {
$(this).animate({width:"250px"}, 1000);
}).blur(function() {
$(this).animate({width:"70px"}, 1000);
});
});
});
</script>
어떤 식으로 위 소스를 추가해야 하는지요?
답변을 작성하려면 로그인이 필요합니다.