Created
May 26, 2015 01:19
-
-
Save bgaeddert/d2552bb69486965f3d5b to your computer and use it in GitHub Desktop.
Revisions
-
bgaeddert created this gist
May 26, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,43 @@ function onBreakPointChange(breakPoint){ // Put code here to run on any break point change. // Ex. large to medium and medium to large and small to medium... if (matchMedia(Foundation.media_queries['small']).matches){ // Put code here to run when page changes to small } if (matchMedia(Foundation.media_queries['medium']).matches){ // Put code here to run when page changes to medium } if (matchMedia(Foundation.media_queries['large']).matches){ // Put code here to run when page changes to large } if (matchMedia(Foundation.media_queries['xlarge']).matches){ // Put code here to run when page changes to xlarge } } var lastBreakPoint = null; $(window).on("resize",function() { var currentBreakPoint = null; if (matchMedia(Foundation.media_queries['small']).matches){ currentBreakPoint = 'small'; } if (matchMedia(Foundation.media_queries['medium']).matches){ currentBreakPoint = 'medium'; } if (matchMedia(Foundation.media_queries['large']).matches){ currentBreakPoint = 'large'; } if (matchMedia(Foundation.media_queries['xlarge']).matches){ currentBreakPoint = 'xlarge'; } if(lastBreakPoint != currentBreakPoint){ lastBreakPoint = currentBreakPoint; onBreakPointChange(currentBreakPoint); } });