﻿/* Created by: Tim Eldridge | Date: 03/05/2011 | Usage: Call by using the following $("#[CONTROL ID HERE]").DropDownListResizer(); */
//(function($) { $.fn.DropDownListResizer = function() { var origWidth = 0; $(this).live("mousedown", function() { if ($(this).css("width") != "auto") { var width = $(this).outerWidth(true); if (origWidth == 0) origWidth = $(this).outerWidth(true); $(this).css("width", "auto"); if ($(this).outerWidth(true) < width) $(this).css("width", origWidth); else $(this).css("width", "auto"); $(this).focus() } }).live("blur change", function() { $(this).css("width", origWidth) }) } })(jQuery);

(function($) {
    $.fn.DropDownListResizer = function(options) {
        var actWidth = 0;

        $(this).live("mousedown focusin", function() {
            if ($(this).data("cssWidth") == undefined)
                $(this).data("cssWidth", $(this).outerWidth(true));

            if ($(this).data("actWidth") == undefined)
                $(this).data("actWidth", $(this).css("width", "auto").css("width").replace("px", ""));

            if ($(this).css("width") != "auto") {
                actWidth = ($(this).data("cssWidth") > $(this).data("actWidth")) ? $(this).data("cssWidth") : $(this).data("actWidth");

                $(this).css("width", actWidth);
            }
        }).live("focusout change", function() {
            $(this).css("width", $(this).data("cssWidth"));
        });
    };
})(jQuery);

