forked from ConciseCSS/concise.css
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnon-responsive.js
More file actions
52 lines (45 loc) · 1.38 KB
/
non-responsive.js
File metadata and controls
52 lines (45 loc) · 1.38 KB
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
48
49
50
51
52
(function($){
/**
* Calculate object width
*
*/
$.fn.calculateWidth = function() {
return $(this).width();
};
/**
* Calculates proper widths for non-responsive websites.
*
* @method nonResponsive
* @note Only necessary for non-responsive websites.
*/
$.fn.nonResponsive = function() {
// Loop through each instance of the `.non-responsive` class
this.each(function(index) {
if ($(this).hasClass("non-responsive")) {
// Get container width
var containerWidth = $(".container").width(),
i = 1,
max = 24;
// Set pixel-based alternatives for grid styles
// But first we need to know if our row has class `gutters`
if($(this).hasClass("gutters")) {
for (; i <= max; i++ ) {
// Column width for row with gutters
var columnWidth = ($('.column-'+i).calculateWidth()),
gutterWidth = columnWidth * 0.02;
$('.gutters .column-'+i).css("width", columnWidth - gutterWidth + "px");
}
} else {
for (; i <= max ; i++ ) {
// Column width for normal row
var columnWidth = ($('.column-'+i).calculateWidth() - 1);
$('.column-'+i).css("width", columnWidth + "px");
}
}
}
});
};
}(jQuery));
jQuery(document).ready(function() {
jQuery("body, .row").nonResponsive();
});