Goos / js-resizer

Just a simple resize-listener

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#Resizer-class
###Easily listen on resize on a per-element basis!
##Methods:
###Resizer.addSizeListener()
@param args
{
<Array, int> sizes : The sizes to listen for,
inside : Callback on match,
[ outside] : Callback on mismatch,
[ listenerType] : "width" or "height"
},
[@param $context] : Element-context function is called from.

###$().addSizeListener()
Same as above, with the $context provided as "$(this)".

###Resizer.scanClasses(element) Scans the provided element after DOM-nodes with the data-[media]class attributes, with [media] being either mobile | tablet | desktop.

e.g: 
<div class = "box" data-mobileclass="mobile-box" data-tabletclass="tablet-box">

##Example usage: $('.my-object').addSizeListener({
sizes : [0, 768],
listenerType: "width",
inside : function() { console.log("success!"); },
outside : function() { console.log("Still outside.."); }
});

About

Just a simple resize-listener


Languages

Language:JavaScript 100.0%