I write more about Media Queries, but I need another plan.
My website is a full screen video background 100% site - I make animations in Adobe After Effects and render to VP8 & VP9 codec.
All looks very nice in 1080 x 1920 but if I scale my browser down to 1366 x 768 (Laptop) the site looks bad because the movies are cropped too much.
And you know I make in another folder a special html file + special render video in 480p. And this is looks very nice. But i can't redirect this if the user is scaling my site in the browser in real time.
I need a script that in controls the width of the browser in real time, and redirects to special dedicated site. Because my movies in webm. .mp4 .ogv must refresh from 720p to 480p and I can't make it in Media Queries.
I use html:
<link href="css.css" rel="stylesheet" type="text/css">
<script src="http://code.jquery.com/jquery-2.0.1.js"></script>
<script type="text/javascript" src="js/redirect.js"></script>
<body>
<div id="big"><video preload="auto" autoplay loop muted="muted" volume="0">
<source src="video/of.webm" type='video/webm; codecs="vp9"'></video></div>
<div id="menu"><a href="intro.html" class="ex2-fadeout" >In</a> <a href="cut.html" class="ex2-fadeout">Ofe</a> <a href="portfolio.html" class="ex2-fadeout">Pf</a> <a href="kontacy.html" class="ex2-fadeout">Contact</a></div>
</body></html>
in redirect.js i use
$(window).resize(function () {
/* call some function */
});
var width = $(window).width();
var height = $(window).height();
$(document).ready(function(){
//this is called only once
r($(window).height());
});
$(window).resize(function () {
//this is called everytime when you resize window
r($(window).height());
});
function r(h) {
if (h > 1024) window.location.replace("http://google.com"); //this is edited
return 0;
}
What i make bad?