日期:2014-05-16  浏览次数:20316 次

js的格式问题!~~~~~~!!
想问问最前面加个“;”是干嘛用??!!
JScript code

;(function($) {
    var defaults = {
        mouseOutOpacity:   0.67,
        mouseOverOpacity:  1.0,
        fadeSpeed:         'fast',
        exemptionSelector: '.selected'
    };

    $.fn.opacityrollover = function(settings) {
        // Initialize the effect
        $.extend(this, defaults, settings);

        var config = this;

        function fadeTo(element, opacity) {
            var $target = $(element);
            
            if (config.exemptionSelector)
                $target = $target.not(config.exemptionSelector);    
            
            $target.fadeTo(config.fadeSpeed, opacity);
        }

        this.css('opacity', this.mouseOutOpacity)
            .hover(
                function () {
                    fadeTo(this, config.mouseOverOpacity);
                },
                function () {
                    fadeTo(this, config.mouseOutOpacity);
                });

        return this;
    };
})(jQuery);



------解决方案--------------------
防止因为合并书写不规范的js(没有以;结尾的代码)后导致的问题
------解决方案--------------------
探讨

防止因为合并书写不规范的js(没有以;结尾的代码)后导致的问题