檢查網址是否被縮小或放大


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<script lanugage="javascript" type="text/javascript">
(function(window, undefined) {

var currentWidth = window.screen.width;

window.onresize = function() {
if (window.screen.width < currentWidth) {
console.log("Zoom In");
}else{
console.log("Zoom Out");
}

currentWidth = window.screen.width;
}

})(window);
</script>
</script>