From 32348e0223869b825e51d368c535781dacab1427 Mon Sep 17 00:00:00 2001 From: Noah Date: Mon, 28 Jan 2013 22:13:56 +0000 Subject: [PATCH] Added ability to customize frequency of polling for event --- README.md | 4 +++- breakpoints.js | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ff317fa..e57ac5b 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,9 @@ Created by [XOXCO](http://xoxco.com) 480, 768, 1024 - ] + ], + // how often to check for breakpoint + frequency: 250 }); $(window).bind('enterBreakpoint320',function() { diff --git a/breakpoints.js b/breakpoints.js index 2e73a35..e44da56 100644 --- a/breakpoints.js +++ b/breakpoints.js @@ -30,7 +30,8 @@ $.fn.setBreakpoints = function(settings) { var options = jQuery.extend({ distinct: true, - breakpoints: new Array(320,480,768,1024) + breakpoints: new Array(320,480,768,1024), + frequency: 250 },settings); @@ -84,7 +85,9 @@ if (lastSize != w) { lastSize = w; } - },250); + + //check for breakpoint every [frequency] ms (default = 250 ms) + },options.frequency); }; })(jQuery);