Nic Mendoza

0

I am running into an issue where setting the html of a tooltip causes an error in jQuery, because the DomNodeRemoval event gets triggered on a child comment node and Sizzle doesn't know how to deal with nodes that lack the getAttribute method.
Since [j... (continued)

This has been sitting here for a while, but since I was looking to do something along these lines, how about something like the following. It allows you to subscribe to resize events like so, which will fire at most every 250 milliseconds when the window is resized:

$('body').on('resize.fndtn.media', function(event,size){
// do something with size, which will be one of the sizes // "small", "medium", etc.
});

It does bring in underscore as a depency for throttling, but you could easily remove that (threw it in a UMD wrapper for use with AMD-style loaders or as a drop-in)

This has been sitting here for a while, but since I was looking to do something along these lines, how about something like the following. It allows you to subscribe to resize events like so, which will fire at most every 250 milliseconds when the window is resized:

$('body').on('resize.fndtn.media', function(event,size){
// do something with size, which will be one of the sizes // "small", "medium", etc.
});

It does bring in underscore as a depency for throttling, but you could easily remove that (threw it in a UMD wrapper for use with AMD-style loaders or as a drop-in)