Last active
September 8, 2015 17:09
-
-
Save foleyatwork/6bbc1ff52a6dddbd7624 to your computer and use it in GitHub Desktop.
An example of a controller.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This controller pattern relies on a createController method that | |
* I typically create in my site.js. To see a boilerplate site.js file | |
* that works with this style, see the link below. | |
* | |
* @see https://gist.github.com/foleyatwork/f2a67d4a28f43a55d1cd | |
*/ | |
Site.createController('RefreshImagesOnResize', function() { | |
// When using jQuery inside of a controller, just assume the | |
// '$' global is available. | |
$(window).resize(function() { | |
$('img[data-src]').each(function() { | |
ImageLoader.load(this); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment