Team:UCLondon/Templates/Content-Slide
From 2012e.igem.org
(Difference between revisions)
Line 242: | Line 242: | ||
$(this).children('#box-content4').html(loading); | $(this).children('#box-content4').html(loading); | ||
}); | }); | ||
+ | } | ||
+ | |||
+ | |||
+ | /* fullscreen functions */ | ||
+ | |||
+ | // makes sure function works with vendor prefixes | ||
+ | var pfx = ["webkit", "moz", "ms", "o", ""]; | ||
+ | function RunPrefixMethod(obj, method) { | ||
+ | var p = 0, m, t; | ||
+ | while (p < pfx.length && !obj[m]) { | ||
+ | m = method; | ||
+ | if (pfx[p] == "") { | ||
+ | m = m.substr(0,1).toLowerCase() + m.substr(1); | ||
+ | } | ||
+ | m = pfx[p] + m; | ||
+ | t = typeof obj[m]; | ||
+ | if (t != "undefined") { | ||
+ | pfx = [pfx[p]]; | ||
+ | return (t == "function" ? obj[m]() : obj[m]); | ||
+ | } | ||
+ | p++; | ||
+ | } | ||
} | } | ||
var fstoggle = function() { | var fstoggle = function() { | ||
- | if (document | + | if (RunPrefixMethod(document, "IsFullScreen")){ |
- | + | RunPrefixMethod(document, "CancelFullScreen"); | |
} | } | ||
else { | else { | ||
- | document.getElementById('shadow4') | + | RunPrefixMethod(document.getElementById('shadow4'), "RequestFullScreen"); |
} | } | ||
} | } |
Revision as of 23:29, 18 October 2012