-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathtext.html
101 lines (78 loc) · 3.67 KB
/
text.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Anything Zoomer | Text</title>
<link href="https://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="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/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="https://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>