Created
October 2, 2016 08:16
-
-
Save MorkHub/5f1b2c5a1e9cedf921a67385210a3c0e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(window).resize(function(){ | |
width = $(this).width(); | |
map = $('div#map'); | |
imgWidth = $('div#map img').width(); | |
scale = width / imgWidth; | |
transform = 'translateY(-'+10/scale+'%) translateX(-'+10/scale+'%) scale('+scale+')'; | |
map.css({ | |
'width' : (100/scale)+'%', | |
'-webkit-transform' : transform, | |
'-moz-transform' : transform, | |
'-ms-transform' : transform, | |
'-o-transform' : transform, | |
'transform' : transform | |
}); | |
console.log('div#map { width: %s%; transform: %s; }',(100/scale),transform); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment