Debian Codegraph @

README.md

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 # jQuery Center Plugin
2
3 A jQuery plugin that centralizes DOM element.
4
5
6
7 ## Description
8
•9 This simple plugin helps you centralize your DOM element against their parent element or the window. You can also specify the top of the DOM element by passing customized settings. This plugin only works for **absolute elements**.
10
11
12
13 ## Demo
14 - Please see demo.html
15 - Live demo please take a look at [this](http://dreamerslab.com/demos/centralize-html-dom-element-with-jquery-center-plugin)
16
17
18
19 ## Documentation
20 - There is a syntax highlight version, please see [this post](http://dreamerslab.com/blog/en/centralize-html-dom-element-with-jquery-center-plugin/)
21 - For chinese version please go [here](http://dreamerslab.com/blog/tw/centralize-html-dom-element-with-jquery-center-plugin/)
22
23
24
25 ## Requires
26 - jQuery 1.2.6+
27
28
29
30 ## Browser Compatibility
31 - [Firefox](http://mzl.la/RNaI) 2.0+
32 - [Internet Explorer](http://bit.ly/9fMgIQ) 6+
33 - [Safari](http://bit.ly/gMhzVR) 3+
34 - [Opera](http://bit.ly/fWJzaC) 10.6+
35 - [Chrome](http://bit.ly/ePHvYZ) 8+
36
37
38
39 ## Installation
40 - First, make sure you are using valid [DOCTYPE](http://bit.ly/hQK1Rk)
41 - Include nessesary JS files
42
43 <!-- -->
44
45 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
46 <script type="text/javascript" src="path-to-file/jquery.center.js"></script>
47
48
49
50 ## Options
51
52 #### against
53 - description: the element that the DOM element centralize against to
54 - data type: string
55 - default value: 'window'
56 - possible value: 'window', 'parent', or '.someTarget'
57
58 #### top
59 - description: you can specify the top of the target element
60 - data type: integer
61 - default value: false
62 - possible value: 13, 20, 36 ... any number you want
63
64 #### topPercentage
65 - description: or specify the top in percentage of the target element
66 - data type: float
67 - default value: 0.5
68 - possible value: 0.1, 0.4, 0.8 ...
69
70 #### resize
71 - description: center on window resize
72 - data type: boolean
73 - default value: true
74 - possible value: true | false
75
76 ## Usage
77 > Example code:
78
79 // centralize #some-element against the window
80 $( '#some-element' ).center();
81
82 // centralize .some-element against its parent element
83 $( '.some-element' ).center({
84 against : 'parent',
85 top : 10
86 });
87
88 // centralize .some-element against '.some-target-element'
89 // !IMPORTANT '.some-target-element' must be ".some-element"'s parents
90 $( '.some-element' ).center({
91 against : '.some-target-element',
92 topPercentage : 0.4
93 });
94
95
96
97 ## License
98
99 The expandable plugin is licensed under the MIT License (LICENSE.txt).
100
101 Copyright (c) 2011 [Ben Lin](http://dreamerslab.com)