My initial pass is adapted from http://css-tricks.com/select-cuts-off-options-in-ie-fix/. I found it some what long winded and only solved part of the problem.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | function dropDownListFixup(sender, args) { var el, ua = $.browser, up = (sender) ? "#" + sender._updatePanelClientIDs.join( ",#" ) : null , selects = $( "select" , up); if (ua.msie && Number(ua.version) < 9) { selects .each( function () { el = $( this ); el.data( "oWidth" , el.outerWidth()); }) .mouseenter( function () { $( this ).css( "width" , "auto" ); }) .bind( "blur change" , function () { el = $( this ); el.css( "width" , el.data( "oWidth" )); }); } selects.each( function (e) { this .title = $( ":selected" , $( this )).text(); }); } $( function () { var prm = Sys.WebForms.PageRequestManager.getInstance(); prm.add_endRequest(dropDownListFixup); dropDownListFixup(); $( "body" ).delegate( "select" , "change" , function (e) { this .title = $( ":selected" , $( this )).text(); }); }); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | // Adapted from: http://css-tricks.com/select-cuts-off-options-in-ie-fix/ function dropDownListSetTitles(sender, args, e) { var selects = $( "select" , ((sender) ? "#" + sender._updatePanelClientIDs.join( ",#" ) : null )); selects.each( function (e) { var el = $( this ); el.data( "oWidth" , el.outerWidth()); setDropDownListTitle.apply( this , [e]); }); } function setDropDownListTitle(e) { this .title = $( ":selected" , $( this )).text(); } $( function () { // dropDownListFixup dropDownListSetTitles(); if ($.browser.msie && Number($.browser.version) < 9) { //// mouseenter mouseleave $( "body" ).delegate( "select" , "focus" , function () { $( this ).css( "width" , "auto" ); }) .delegate( "select" , "blur change" , function () { var el = $( this ); el.css( "width" , el.data( "oWidth" )); }); } $( "body" ).delegate( "select" , "change" , setDropDownListTitle); Sys.WebForms.PageRequestManager.getInstance().add_endRequest(dropDownListSetTitles); }); |
No comments:
Post a Comment