Skip to content

Commit f043d69

Browse files
committed
Updated markdown
1 parent 6e9ebd9 commit f043d69

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

README

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,40 @@
1-
== jQuery Flex Vertical Center
1+
jQuery Flex Vertical Center
2+
===========================
23

34
This jQuery plugin provides an easy way to vertically center an element in its parent. Even if the parents height changes after resizing the browser window, in a fluid or responsive layout for example.
45

56

6-
== Usage
7+
Usage
8+
-----
79

810
Simply include this file in your project (after loading jQuery) like this:
911

1012
<script defer src="js/jquery.flexverticalcenter.js"></script>
1113

1214
Then call the plugin on the element which needs to be vertically centered in it's parent.
1315

14-
<script>
15-
$(document).ready(function() {
16-
$('#element-to-be-centered').flexVerticalCenter();
17-
});
18-
</script>
16+
<script>
17+
$(document).ready(function() {
18+
$('#element-to-be-centered').flexVerticalCenter();
19+
});
20+
</script>
1921

2022
This will take the parents height, the elements own height and calculate the distance the element should have from the parents top to be vertically centered. This value is applied to the top margin of the element by default.
2123

2224

23-
== Options
25+
Options
26+
-------
2427

2528
You can pass one parameter to the plugin, which is the css attribute that the value should be set on. The default is 'margin-top', but you can pass any attribute you would like. Most probably 'padding-top' or 'top'.
2629

27-
<script>
28-
$(document).ready(function() {
29-
$('#element-to-be-centered').flexVerticalCenter('padding-top');
30-
});
31-
</script>
30+
<script>
31+
$(document).ready(function() {
32+
$('#element-to-be-centered').flexVerticalCenter('padding-top');
33+
});
34+
</script>
3235

3336

34-
== Note
37+
Note
38+
----
3539

3640
The initial code was more or less borrowed from the awesome FitText plugin. http://fittextjs.com/

0 commit comments

Comments
 (0)