Skip to content

Goos/js-resizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

#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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published