Skip to content

Commit

Permalink
Fix for $ is undefined on some jQuery newer versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
franverona committed Nov 2, 2015
1 parent b54f8c3 commit 639722c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
10 changes: 5 additions & 5 deletions loadgo.js
Expand Up @@ -139,10 +139,10 @@ if (typeof jQuery === 'undefined') { throw new Error('LoadGo requires jQuery');

// Resize event
if (defaults.resize) {
$(window).on('resize', defaults.resize);
jQuery(window).on('resize', defaults.resize);
}
else {
$(window).on('resize', function() {
jQuery(window).on('resize', function() {
var $element = $this, data = $element.data('loadgo');
var $overlay = data.overlay, progress = data.progress, direction = data.direction, filter = data.filter;
var _w = $element.width(), _h = $element.height(), pl = $element.parent().css('padding-left');
Expand Down Expand Up @@ -235,7 +235,7 @@ if (typeof jQuery === 'undefined') { throw new Error('LoadGo requires jQuery');
}
}

jQuery(this).data('loadgo', $.extend({}, data, {progress: progress}));
jQuery(this).data('loadgo', jQuery.extend({}, data, {progress: progress}));
}
},

Expand Down Expand Up @@ -295,14 +295,14 @@ if (typeof jQuery === 'undefined') { throw new Error('LoadGo requires jQuery');
}
};

$.fn.loadgo = function (methodOrOptions) {
jQuery.fn.loadgo = function (methodOrOptions) {
if ( methods[methodOrOptions] ) {
return methods[ methodOrOptions ].apply( this, Array.prototype.slice.call( arguments, 1 ));
} else if ( typeof methodOrOptions === 'object' || ! methodOrOptions ) {
// Default to "init"
return methods.init.apply( this, arguments );
} else {
$.error( 'Method ' + methodOrOptions + ' does not exist on jQuery.loadgo' );
jQuery.error( 'Method ' + methodOrOptions + ' does not exist on jQuery.loadgo' );
}
};

Expand Down
12 changes: 1 addition & 11 deletions loadgo.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 639722c

Please sign in to comment.