Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ module.exports = function(grunt) {
browser: true,
node: true,
predef: {
jQuery: true
jQuery: true,
define: true
}
}
},
Expand Down
17 changes: 14 additions & 3 deletions jquery.stellar.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@
* http://markdalgleish.mit-license.org
*/

;(function($, window, document, undefined) {
;(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(function(require) {
var $ = require('jquery');
factory($, window, document);
});
} else {
// Browser globals
factory(jQuery, window, document);
}
}(function($, window, document, undefined) {

var pluginName = 'stellar',
defaults = {
Expand Down Expand Up @@ -371,7 +382,7 @@
$backgroundElements = this.$element.find('[data-stellar-background-ratio]');

if (this.$element.data('stellar-background-ratio')) {
$backgroundElements = $backgroundElements.add(this.$element);
$backgroundElements = $backgroundElements.add(this.$element);
}

$backgroundElements.each(function() {
Expand Down Expand Up @@ -657,4 +668,4 @@

// Expose the plugin class so it can be modified
window.Stellar = Plugin;
}(jQuery, this, document));
}));
Loading