JSFiddle - React, Tailwind, and code Playground
JavaScript
$(document).ready(function () {
console.log('dom rdy...');
$.WindowResize({
autoResize: true,
resizeDelay: 50
});
});
/*!
jQuery Window Resize plugin Template
@name jquery.windowResize.js
@author Christoph Ono ([email protected] or @gbks)
@author Sebastian Helzle ([email protected] or @sebobo)
@author Sam Deering ([email protected] or @jquery4u)
@version 1.0
@date 08/04/2013
@category jQuery Plugin
@copyright (c) 2009-2013 Christoph Ono (wookmark.com)
@copyright (c) 2013 Sam Deering (samdeering.com)
@license Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
*/
(function ($) {
var WindowResize, defaultOptions, __bind;
__bind = function (fn, me) {
return function () {
return fn.apply(me, arguments);
};
};
// Plugin default options.
defaultOptions = {
autoResize: true,
resizeDelay: 50
};
WindowResize = (function (options) {
console.log('new class...');
function WindowResize(handler, options) {
this.handler = handler;
// Plugin variables.
this.resizeTimer = null;
this.container = $('div');
this.resizeCount = 0;
// Extend default options.
$.extend(true, this, defaultOptions, options);
// Bind methods.
this.update = __bind(this.update, this);
this.onResize = __bind(this.onResize, this);
this.clear = __bind(this.clear, this);
// Init.
console.log('class constructor...');
this.container.html('Please resize your window to trigger event.');
// Listen to resize event if requested.
if (this.autoResize) {
$(window).bind('resize.windowResize', this.onResize);
};
};
// Method for updating the plugins options.
WindowResize.prototype.update...