2012-01-23 2 views
1

IE8에서 주목할 필요가 없기 때문에 .mousemove의 문제점은 무엇입니까? 비활성화 된 입력을 20자를 초과하는 값으로 확장해야합니다. IE8에서만 작동하지 않습니다. 또 다른 이유는 커서가 다른 요소에있는 후에 왜 다시 끌리지 않는지입니다..mousemove on IE8

$('input[disabled]').mousemove(function(){ 
     if ($(this).val().length > 20) { 
     $(this).attr('data-default', $(this).width()); 
     $(this).animate({width: 300}, 'slow'); 
     } 
}); 

확인 바이올린 : http://jsfiddle.net/DCjYA/183/

당신을 감사합니다.

답변

2

이 경우 입력 상자와의 추가 상호 작용을 허용하므로 readonly 속성을 사용해야합니다.

당신의 CSS를

 
    input{ 
     margin:10px; 
    } 
    input.readonly { 
     color: grey; 
     cursor:default 
    } 

및 양식

<form action="form_action.asp" method="get"> 
     First name: <input type="text" name="fname" value="Foghorn Leghorn Foghorn Leghorn" readonly="true" class="readonly" /><br /> 
     Last name: <input type="text" name="lname" value="" readonly="true" class="readonly" /><br /> 
     Last name: <input type="text" name="lname" value="Foghorn Leghorn" readonly="true" class="readonly" /><br /> 
    <input type="submit" value="Submit form" style=""/> 
</form> 

와 jQuery를

 
    $('input[readonly]').mousemove(function(){ 
     if ($(this).val().length > 20) { 
       $(this).attr('data-default', $(this).width()); 
       $(this).animate({width: 300}, 'slow'); 
       $(this).parent().addClass('cooling'); 
       } 
    }); 
+0

네, 그것은 작동하고, 원래의 폭에 다시 실행할 때 내 커서 휴직 가능 그 입력? 고맙습니다. – mcmwhfy