I have written a script that switches the float
value from right
to left
when the window is squeezed to a certain horizontal length.
function switchMedia(){
if(w < 1050){
document.getElementById("secondPic").style.cssFloat = "left";
document.getElementById("secondPic").style.marginLeft = "1.5vh";
}
if(w > 1050){
document.getElementById("secondPic").style.cssFloat = "right";
}
}
}
And the listener here:
initialize();
function initialize(){
addEventListener("resize",switchMedia,false);
switchMedia();
}
The odd thing is that it worked for the first values of w
I put in, but once I switched to 1050, the float value will not change.