Skip to content

Instantly share code, notes, and snippets.

@alvarotrigo
Last active September 20, 2018 14:31
Show Gist options
  • Save alvarotrigo/49b1b88f2620276ae554090709211ccc to your computer and use it in GitHub Desktop.
Save alvarotrigo/49b1b88f2620276ae554090709211ccc to your computer and use it in GitHub Desktop.
Current basic structure of fullpage.js
/*!
* I basically want to generate this UMD with some tool.
* Right now I did it manually by copying and pasting some generic one.
*
* But it is failing in some cases due to having in this same file the jQuery
* adator you'll see at the bottom.
*/
(function( root, window, document, factory, undefined) {
if( typeof define === 'function' && define.amd ) {
// AMD. Register as an anonymous module.
define( function() {
root.fullpage = factory(window, document);
return root.fullpage;
} );
} else if( typeof exports === 'object' ) {
// Node. Does not work with strict CommonJS.
module.exports.fullpage = factory(window, document);
} else {
// Browser globals.
window.fullpage = factory(window, document);
}
}(this, window, document, function(window, document){
'use strict';
function initialise(){
console.log("fullpage.js code....");
}
return initialise;
}));
/**
* jQuery adapter for fullPage.js 3.0.0
*/
if(window.jQuery && window.fullpage){
(function ($, fullpage) {
if (!$ || !fullpage) {
window.fp_utils.showError('error', 'jQuery is required to use the jQuery fullpage adapter!');
return;
}
$.fn.fullpage = function(options) {
var FP = new fullpage('#' + $(this).attr('id'), options);
//Static API
Object.keys(FP).forEach(function (key) {
$.fn.fullpage[key] = FP[key];
});
};
})(window.jQuery, window.fullpage);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment