I simply want a function that show alert on zoom in window saying like "you zoomed in" and on zoom out saying like "you zoomed out", I searched for this function for lot of time but every time I search I get like "zooming into window event" and that's not what I'm looking for.
srceen.width is fixed value but where as window.innerWidth value will change as per the zoom effect. please try the below code:
$(window).resize(function() {
if(screen.width == window.innerWidth){
alert("you are on normal page with 100% zoom");
} else if(screen.width > window.innerWidth){
alert("you have zoomed in the page i.e more than 100%");
} else {
alert("you have zoomed out i.e less than 100%")
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With