Created
June 5, 2013 16:16
-
-
Save boostbob/5715171 to your computer and use it in GitHub Desktop.
foundation interchange resize
This file contains 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 characters
resize : function () { | |
var cache = this.cache; | |
for (var uuid in cache) { | |
if (cache.hasOwnProperty(uuid)) { | |
var passed = this.results(uuid, cache[uuid]); | |
if (passed) { | |
this.settings.directives[passed | |
.scenario[1]](passed.el, passed.scenario[0]); | |
} | |
} | |
} | |
}, | |
results : function (uuid, scenarios) { | |
var count = scenarios.length, | |
results_arr = []; | |
if (count > 0) { | |
var el = $('[data-uuid="' + uuid + '"]'); | |
for (var i = count - 1; i >= 0; i--) { | |
var rule = scenarios[i][2]; | |
if (this.settings.named_queries.hasOwnProperty(rule)) { | |
var mq = matchMedia(this.settings.named_queries[rule]); | |
} else { | |
var mq = matchMedia(scenarios[i][2]); | |
} | |
if (mq.matches) { | |
return {el: el, scenario: scenarios[i]}; | |
} | |
} | |
} | |
return false; | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment