From 42034ca24159c375e32c6d905fc45bf031eced74 Mon Sep 17 00:00:00 2001 From: Andy Hausmann Date: Mon, 23 Jan 2012 21:57:32 +0100 Subject: [PATCH 1/3] Updated the Exit-Trigger. Without this fix, the Breakpoints are not being triggert in case of a browser resolution, which is lesser than the lowest defined Breakpoint. --- breakpoints.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/breakpoints.js b/breakpoints.js index 2e73a35..9ed30dc 100644 --- a/breakpoints.js +++ b/breakpoints.js @@ -59,7 +59,7 @@ } // fire onExit when browser contracts out of a larger breakpoint - if (w < options.breakpoints[bp] && lastSize >= options.breakpoints[bp]) { + if (w < options.breakpoints[bp] && (lastSize >= options.breakpoints[bp] || !done)) { $('body').removeClass('breakpoint-' + options.breakpoints[bp]); $(window).trigger('exitBreakpoint' + options.breakpoints[bp]); From 35e13f3ac6c02f92c01b2acd8592e148966b5749 Mon Sep 17 00:00:00 2001 From: Andy Hausmann Date: Tue, 24 Jan 2012 00:39:32 +0100 Subject: [PATCH 2/3] As of jQuery 1.7, the .on() method is the preferred method for attaching event handlers to a document. --- README.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ff317fa..bed2b99 100644 --- a/README.md +++ b/README.md @@ -23,28 +23,27 @@ Created by [XOXCO](http://xoxco.com) ] }); - $(window).bind('enterBreakpoint320',function() { + $(window).on('enterBreakpoint320',function() { ... }); - $(window).bind('exitBreakpoint320',function() { + $(window).on('exitBreakpoint320',function() { ... }); - $(window).bind('enterBreakpoint768',function() { + $(window).on('enterBreakpoint768',function() { ... }); - $(window).bind('exitBreakpoint768',function() { + $(window).on('exitBreakpoint768',function() { ... }); - - $(window).bind('enterBreakpoint1024',function() { + $(window).on('enterBreakpoint1024',function() { ... }); - $(window).bind('exitBreakpoint1024',function() { + $(window).on('exitBreakpoint1024',function() { ... }); From 75d270911f1050657d4b5e0f08c647f9413d1cb7 Mon Sep 17 00:00:00 2001 From: Andy Hausmann Date: Tue, 24 Jan 2012 00:41:53 +0100 Subject: [PATCH 3/3] As of jQuery 1.7, the .off() methods is preferred to remove event handlers. --- breakpoints.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/breakpoints.js b/breakpoints.js index 9ed30dc..a2243fa 100644 --- a/breakpoints.js +++ b/breakpoints.js @@ -20,7 +20,7 @@ var interval = null; $.fn.resetBreakpoints = function() { - $(window).unbind('resize'); + $(window).off('resize'); if (interval) { clearInterval(interval); }