blob: 599f23d1555dcde49b39018f75225100767127ff (
plain)
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
|
/**
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
(function () {
$.fn.showMessage = function(message) {
return this.each(function(i){
$(this).effect("highlight", {"color": "white"}, 3000);
$(this).animate({opacity: 1.0}, 6000);
});
};
})(jQuery);
// Vertically align a block element's content
(function () {
$.fn.vAlign = function(container) {
return this.each(function(i){
if (container == null) {
container = 'div';
}
$(this).html("<" + container + ">" + $(this).html() + "</" + container + ">");
var el = $(this).children(container + ":first");
var elh = $(el).height();
var ph = $(this).height();
var nh = (ph - elh) / 2;
$(el).css('margin-top', nh);
});
};
})(jQuery);
// Get the viewport size
(function () {
$.getViewportSize = function() {
return {
width : function() {
return window.innerWidth
|| document.documentElement && document.documentElement.clientWidth
|| document.body.clientWidth;
},
height : function() {
return window.innerHeight
|| document.documentElement && document.documentElement.clientHeight
|| document.body.clientHeight;
}
};
};
})(jQuery);
|