Firefox 에서는 옵션의 내용만큼 자동으로 커집니다
$(function() {
    $(".ProductAttributesSelect")
        .mouseover(function(){
            $(this)
                .data("origWidth", $(this).css("width"))
                .css("width", "auto");
        })
        .mouseout(function(){
            $(this).css("width", $(this).data("origWidth"));
        });
});특별히 IE 6/7에서만 작동하도록 작성하면 조금 더 나은 코드가 될 것입니다.
이렇게 작성된 스크립트는 사용자가 셀렉트 박스 위에 마우스를 위치 시켰을 때 옵션의 내용만큼 자동으로 길어지게 됩니다. 반대로 마우스가 벗어나면 원래의 크기를 갖습니다.
간단하게 적용시킬 수 있는 방법이며, jQuery가 아닌 다른 자바스크립트 프레임워크를 사용해도 됩니다. 또는 표준 스크립트 문법만을 가지고도 작성할 수 있습니다.
다음은 다른 방법으로 해결된 경우입니다.
- Fix Drop down <select /> with fixed width cutt-off bugs on IE
- Select Box I.E. Width Problem
- Viewing Option Text (in IE7) that's Wider than the Select List
 
댓글 없음:
댓글 쓰기