Skip to content

Instantly share code, notes, and snippets.

@boostbob
Created June 5, 2013 16:16
Show Gist options
  • Save boostbob/5715171 to your computer and use it in GitHub Desktop.
Save boostbob/5715171 to your computer and use it in GitHub Desktop.
foundation interchange resize
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