Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 318c98fd1e
Fetching contributors…

Cannot retrieve contributors at this time

101 lines (78 sloc) 3.75 kb
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Anything Zoomer | Text</title>
<link href="http://fonts.googleapis.com/css?family=Merienda+One" rel="stylesheet">
<link rel="stylesheet" href="demo/style.css">
<link rel="stylesheet" href="css/anythingzoomer.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script src="js/jquery.anythingzoomer.js"></script>
<script>
$(function() {
// clone the small area, the css will define the dimensions
// default class name for the large area is "large"
$("#zoom").anythingZoomer({
clone: true
});
// zoom in
$('button').click(function(){
$(this).addClass('selected').siblings().removeClass('selected');
// .small p { font-size: 8px; width: 300px; }
var origW = 300,
origSz = 8,
// get multiple
multiple = parseInt( $(this).text() );
$('.large p').css({
width: origW * multiple,
fontSize: origSz * multiple
});
// update anythingZoomer window,
// but first turn off clone since cloning the small area again will remove our changes
$('#zoom').getAnythingZoomer().options.clone = false;
$('#zoom').anythingZoomer();
});
});
</script>
</head>
<body id="text">
<div id="main-content">
<h1>AnythingZoomer<sup>2</sup></h1>
<a href="https://github.com/CSS-Tricks/AnythingZoomer/zipball/master" id="dl">Download</a>
<ul id="nav">
<li><a href="index.html">Calendar</a></li>
<li><a href="image.html">Image</a></li>
<li><a href="swap.html">Swap</a></li>
<li><a class="current" href="text.html">Text</a></li>
<li><a href="double.html">Double</a></li>
<li><a class="use" href="use.html">Usage</a></li>
<li><a class="play" href="http://jsfiddle.net/Mottie/KwvjL/">Playground</a></li>
<li><a class="issue" href="https://github.com/CSS-Tricks/AnythingZoomer/issues">Issues</a></li>
</ul>
<h2>Text Demo</h2>
<p>
<ul class="info">
<li>This demo uses the "clone" option to clone the original "small" content.</li>
<li>The new "large" content must have existing css definitions to determine it's style.</li>
<li>Change the size of the large content by clicking the buttons below; the update method is used here.</li>
<li><em>Note:</em> There is an issue with the zoom window being positioned more down and right as the large content size increases. I'll keep looking for a solution, but for now you can use the <code>offsetX</code> and <code>offsetY</code> options to tweak the position.</li>
</ul>
</p>
<p>
<button class="selected">2x</button>
<button>2.5x</button>
<button>3x</button>
<button>3.5x</button>
<button>4x</button>
</p>
<hr>
<div id="zoom" class="text">
<div class="small">
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus.</p>
</div>
<!-- the cloned "small" content will be added to div.large -->
<div class="large">This text will be replaced since the "clone" option is set to true</div>
</div> <!-- end zoom -->
</div> <!-- end main content -->
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.