Révision 70a4c29b
Ajouté par Assos Assos il y a environ 9 ans
drupal7/sites/all/themes/mayo/js/mayo-fontsize.js | ||
---|---|---|
2 | 2 |
* @file |
3 | 3 |
* Adds javascript functions for font resizing. |
4 | 4 |
*/ |
5 |
jQuery(document).ready(function() { |
|
6 |
var originalFontSize = jQuery('body').css('font-size'); |
|
5 |
(function ($) { |
|
6 |
$(document).ready(function() { |
|
7 |
var originalFontSize = $('body').css('font-size'); |
|
7 | 8 |
|
8 | 9 |
// Reset font size |
9 |
jQuery(".resetFont").click(function() {
|
|
10 |
$(".resetFont").click(function() {
|
|
10 | 11 |
mayoColumnsResetHeight(); |
11 |
jQuery('body').css('font-size', originalFontSize);
|
|
12 |
$('body').css('font-size', originalFontSize);
|
|
12 | 13 |
mayoColumnsAdjustHeight(); |
13 | 14 |
return false; |
14 | 15 |
}); |
15 | 16 |
|
16 | 17 |
// Increase font size |
17 |
jQuery(".increaseFont").click(function() {
|
|
18 |
var currentFontSize = jQuery('body').css('font-size');
|
|
18 |
$(".increaseFont").click(function() {
|
|
19 |
var currentFontSize = $('body').css('font-size');
|
|
19 | 20 |
var currentFontSizeNum = parseFloat(currentFontSize, 10); |
20 | 21 |
var newFontSizeNum = currentFontSizeNum + 1; |
21 | 22 |
if (20 >= newFontSizeNum) { /* max 20px */ |
22 | 23 |
var newFontSize = newFontSizeNum + 'px'; |
23 | 24 |
mayoColumnsResetHeight(); |
24 |
jQuery('body').css('font-size', newFontSize);
|
|
25 |
$('body').css('font-size', newFontSize);
|
|
25 | 26 |
mayoColumnsAdjustHeight(); |
26 | 27 |
} |
27 | 28 |
return false; |
28 | 29 |
}); |
29 | 30 |
|
30 | 31 |
// Decrease font size |
31 |
jQuery(".decreaseFont").click(function() {
|
|
32 |
var currentFontSize = jQuery('body').css('font-size');
|
|
32 |
$(".decreaseFont").click(function() {
|
|
33 |
var currentFontSize = $('body').css('font-size');
|
|
33 | 34 |
var currentFontSizeNum = parseFloat(currentFontSize, 10); |
34 | 35 |
var newFontSizeNum = currentFontSizeNum - 1; |
35 | 36 |
if (10 <= newFontSizeNum) { /* min 10px */ |
36 | 37 |
var newFontSize = newFontSizeNum + 'px'; |
37 | 38 |
mayoColumnsResetHeight(); |
38 |
jQuery('body').css('font-size', newFontSize);
|
|
39 |
$('body').css('font-size', newFontSize);
|
|
39 | 40 |
mayoColumnsAdjustHeight(); |
40 | 41 |
} |
41 | 42 |
return false; |
42 | 43 |
}); |
43 | 44 |
}); |
45 |
})(jQuery); |
|
46 |
|
|
47 |
function mayoEqualHeight(group) { |
|
48 |
var tallest = 0; |
|
49 |
group.each(function() { |
|
50 |
var thisHeight = jQuery(this).height(); |
|
51 |
if (thisHeight > tallest) { |
|
52 |
tallest = thisHeight; |
|
53 |
} |
|
54 |
}); |
|
55 |
group.height(tallest); |
|
56 |
} |
|
44 | 57 |
|
45 | 58 |
function mayoColumnsResetHeight() { |
46 | 59 |
// reset height of column blocks to 'auto' before chaning font size |
Formats disponibles : Unified diff
Weekly update of contrib modules