Adding Javascript Code
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
button {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
margin: 8px ;
|
||||
background-color: darkcyan;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
input{
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
.webBox{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.boxText{
|
||||
display:block;
|
||||
float:left;
|
||||
padding:5px 10px
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
function setSize(varWidth, varHeight){
|
||||
var box = document.getElementById("webBoxSel");
|
||||
var boxHeight = (varHeight / 2);
|
||||
var boxwidth = (varWidth / 2);
|
||||
|
||||
if(boxHeight >= 300)
|
||||
{
|
||||
box.style.backgroundColor = 'red';
|
||||
}else{
|
||||
box.style.backgroundColor = 'yellow';
|
||||
}
|
||||
|
||||
box.style.width = boxwidth+'px';
|
||||
box.style.height = boxHeight+'px';
|
||||
|
||||
var textInBox = document.getElementById("boxText");
|
||||
|
||||
textInBox.style.color = 'blue';
|
||||
textInBox.style.margin = '25%';
|
||||
textInBox.style.marginLeft = '25%';
|
||||
|
||||
}
|
||||
|
||||
if(document.readyState === "loading"){
|
||||
const varW = window.outerWidth;
|
||||
const varH = window.outerHeight;
|
||||
setSize(varW, varH);
|
||||
}
|
||||
|
||||
window.addEventListener("resize", function (){
|
||||
|
||||
const varW = window.outerWidth;
|
||||
const varH = window.outerHeight;
|
||||
setSize(varW, varH);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user