Debian Codegraph @

demo.html

raw symbols ◀ ▶ SCIP
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>jQuery Center Plugin Demo</title>
6 <style type="text/css">
7 h1{
8 text-align : center;
9 }
10 #wrap{
11 width: 880px;
12 margin: 0 auto 50px;
13 }
14 #info{
15 text-align: center;
16 margin: 50px 0 0;
17 }
18 #play-ground1{
19 height: 150px;
20 }
21 #play-ground2{
22 height: 220px;
23 position: relative;
24 }
25 .spacer{
26 height: 50px;
27 }
28 .parent{
29 width: 200px;
30 height: 200px;
31 position: relative;
32 background: #cccccc;
33 display: inline;
34 float: left;
35 margin: 0 20px 0 0;
36 }
37 .some-element{
38 width: 100px;
39 height: 100px;
40 position: absolute;
41 background: #333333;
42 color: white;
43 }
44 .btn{
45 background: #cccccc;
46 float: left;
47 display: inline;
48 font-family: arial;
49 font-size: 12px;
50 font-weight: bolder;
51 padding: 3px 7px;
52 margin: 0 8px 0 0;
53 cursor: pointer;
54 }
55 </style>
56 </head>
57 <body>
58 <div id="wrap">
59 <h1>
60 jQuery Center Plugin Demo
61 </h1>
62 <p>
63 Try clicking the buttons to see how they works :)
64 </p>
65 <h2>
66 centralize #some-element against the window
67 </h2>
68 <div id="sample1" class="spacer">
69 <div id="btn1" class="btn">Centralize</div>
70 <div class="btn restore">Restore</div>
71 </div>
72 <div id="play-ground1">
73 <div id="some-element" class="some-element">
74 #some-element
75 </div>
76 </div>
77 <h2>
78 centralize .some-element against its parent
79 </h2>
80 <div id="sample2" class="spacer">
81 <div id="btn2" class="btn">Centralize</div>
82 <div class="btn restore">Restore</div>
83 </div>
84 <div id="play-ground2">
85 <div class="parent">
86 .parent
87 <div class="some-element">
88 .some-element
89 </div>
90 </div>
91 <div class="parent">
92 .parent
93 <div class="some-element">
94 .some-element
95 </div>
96 </div>
97 <div class="parent">
98 .parent
99 <div class="some-element">
100 .some-element
101 </div>
102 </div>
103 <div class="parent">
104 .parent
105 <div class="some-element">
106 .some-element
107 </div>
108 </div>
109 </div>
110 <h3 id="info">
111 Demo provides by <a href="http://dreamerslab.com/">DreamersLab</a>
112 </h3>
113 </div>
114 <script type="text/javascript" src="file:///usr/share/javascript/jquery/jquery.js"></script>
115 <script type="text/javascript" src="file:///usr/share/javascript/libjs-jquery-center/jquery.center.js"></script>
116 <script type="text/javascript" charset="utf-8">
117 // wrap everything in document ready event
118 $( function(){
119
120 // cache jquery obj
121 var $el = $( '#some-element' );
122 var $pg2el = $( '#play-ground2' ).find( '.some-element' );
123
124 // centerize '#some-element' against the window on clicking #btn1
125 $( '#btn1' ).bind( 'click', function(){
126 $el.center();
127 });
128
129 // restore '#some-element' position on clicking '.restore'
130 $( '#sample1' ).find( '.restore' ).bind( 'click', function(){
131 $el.attr( 'style', '' );
132 });
133
134 // centerize each '.some-element' against its parent on clicking #btn2
135 $( '#btn2' ).bind( 'click', function(){
136 $pg2el.center({ against: 'parent' });
137 });
138
139 // restore '.some-element' position on clicking '.restore'
140 $( '#sample2' ).find( '.restore' ).bind( 'click', function(){
141 $pg2el.attr( 'style', '' );
142 });
143 });
144
145
146 </script>
147 </body>
148 </html>