html
html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!-- created by JaScript
in addition the loader and image are responsible in all orientations.
Please upvote -->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale = 1, minimum-scale = 1, user-scalable = no, minimal-ui" />
<title>Orientationchange</title>
</head>
<body>
<div class="loader"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div>
<script>
onload = () => {
loader = document.querySelector('.loader');
loaderOn();
img = document.createElement("img");
img.src = "https://www.dropbox.com/s/c15iccgwjfigszf/IMG_0058.jpg?raw=1";
orient();
document.body.appendChild(img);
img.onload = () => loaderOff();
}
</script>
</body>
</html>
Enter to Rename, Shift+Enter to Preview
css
css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* created by JaScript
Please upvote */
body {
background: lightblue;
margin: 0;
}
.loader {
display: inline-block;
position: absolute;
top: 50%;
bottom: auto;
left: 50%;
right: auto;
width: 30vw;
height: 30vw;
line-height: 30vh;
opacity: 0;
}
.loader div {
transform-origin: 1vw 1vw;
animation: loaderpik 2.4s linear infinite;
}
.loader div:after {
content: " ";
display: block;
position: absolute;
top: 0.8vw;
left: 7vw;
Enter to Rename, Shift+Enter to Preview
js
js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* created by JaScript
Please upvote */
let loader=null,w,h,minwh,mar=40;
let img = new Image;
function loaderOn() {
loader.classList.add('loader--visible');
}
function loaderOff() {
loader.classList.remove('loader--visible');
}
function orient(){
w = innerWidth;
h = innerHeight;
minwh = Math.min(w,h)-mar*2;
img.width = minwh;
img.height = minwh;
img.style.paddingTop = (h-minwh)/2+"px";
img.style.paddingLeft = (w-minwh)/2+"px";
}
window.addEventListener('orientationchange',function(e){
orient();
});
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run