Created
October 13, 2012 16:26
-
-
Save Sleavely/3885233 to your computer and use it in GitHub Desktop.
OTMap - CSS-zoom
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
<!DOCTYPE html> | |
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]--> | |
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]--> | |
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]--> | |
<!--[if gt IE 8]><!--> <html class="no-js" lang="sv-SE"> <!--<![endif]--> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Zoomable OTMap</title> | |
<style> | |
*{ | |
-webkit-transition:all 0.3s linear; | |
-moz-transition:all 0.3s linear; | |
-o-transition:all 0.3s linear; | |
transition:all 0.3s linear; | |
} | |
button.active{ | |
font-weight: bold; | |
} | |
#map-wrapper{ | |
background-image: url(); | |
background-repeat: repeat; | |
font-size: 0px; | |
} | |
#map-wrapper div{ | |
background-position: bottom right; | |
background-repeat: no-repeat; | |
background-size: contain; | |
display: inline-block; | |
margin: 0; | |
outline: 0; | |
padding: 0; | |
} | |
.zoom6 div{ | |
width: 64px; | |
height: 64px; | |
} | |
.zoom5 div{ | |
width: 32px; | |
height: 32px; | |
} | |
.zoom4 div{ | |
width: 24px; | |
height: 24px; | |
} | |
.zoom3 div{ | |
width: 16px; | |
height: 16px; | |
} | |
.zoom2 div{ | |
width: 12px; | |
height: 12px; | |
} | |
.zoom1 div{ | |
width: 8px; | |
height: 8px; | |
} | |
.g{ | |
background-image: url(http://deryas.otworlds.com/sprites.php?id=4526); | |
} | |
.w{ | |
background-image: url(http://deryas.otworlds.com/sprites.php?id=4618); | |
} | |
.chair{ | |
background-image: url(http://deryas.otworlds.com/sprites.php?id=1988); | |
} | |
</style> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> | |
<script> | |
jQuery(document).ready(function(){ | |
jQuery("button").click(function(){ | |
var newZoom = jQuery(this).text(); | |
jQuery("#map-wrapper").removeClass().addClass(newZoom); | |
jQuery("button").removeClass(); | |
jQuery(this).addClass("active"); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<div id="page-wrapper"> | |
<button>zoom1</button> | |
<button>zoom2</button> | |
<button>zoom3</button> | |
<button>zoom4</button> | |
<button class="active">zoom5</button> | |
<button>zoom6</button> | |
<div id="map-wrapper" class="zoom5"> | |
<div class="w"></div> | |
<div class="w"></div> | |
<div class="w"></div> | |
<div class="w"></div> | |
<div class="w"></div> | |
<div class="w"></div> | |
<div class="g"></div> | |
<div class="g"> | |
<div class="chair"></div> | |
</div> | |
<div class="g"></div> | |
<div class="g"></div> | |
<div class="w"></div> | |
<div class="w"></div> | |
<div class="w"></div> | |
<div class="w"></div> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment