-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomjs.js
244 lines (229 loc) · 6.99 KB
/
Customjs.js
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
$(document).ready(function(){
/*************** Checkbox script ***************/
var inputs = document.getElementsByTagName('input');
for (a = 0; a < inputs.length; a++) {
if (inputs[a].type == "checkbox") {
var id = inputs[a].getAttribute("id");
if (id==null){
id= "checkbox" +a;
}
inputs[a].setAttribute("id",id);
var container = document.createElement('div');
container.setAttribute("class", "ttr_checkbox");
var label = document.createElement('label');
label.setAttribute("for", id);
$(inputs[a]).wrap(container).after(label);
}
}
/*************** Radiobutton script ***************/
var inputs = document.getElementsByTagName('input');
for (a = 0; a < inputs.length; a++) {
if (inputs[a].type == "radio") {
var id = inputs[a].getAttribute("id");
if (id==null){
id= "radio" +a;
}
inputs[a].setAttribute("id",id);
var container = document.createElement('div');
container.setAttribute("class", "ttr_radio");
var label = document.createElement('label');
label.setAttribute("for", id);
$(inputs[a]).wrap(container).after(label);
}
}
/*************** Staticfooter script ***************/
var window_height = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
var body_height = $(document.body).height();
$content = $("#ttr_content_and_sidebar_container");
if(body_height < window_height){
differ = (window_height - body_height);
content_height = $content.height() + differ;
$("#ttr_content_and_sidebar_container").css("min-height", content_height+"px");
}
/* Slideshow Function Call */
if(jQuery('#ttr_slideshow_inner').length){
jQuery('#ttr_slideshow_inner').TTSlider({
slideShowSpeed:4000, begintime:1000,cssPrefix: 'ttr_'
});
}
/*************** Hamburgermenu slideleft script ***************/
$('#nav-expander').on('click',function(e){
e.preventDefault();
$('body').toggleClass('nav-expanded');
});
/*************** Menu click script ***************/
$('ul.ttr_menu_items.nav li [data-toggle=dropdown]').on('click', function() {
var window_width = Math.max(document.documentElement.clientWidth, window.innerWidth || 0)
if(window_width > 1025 && $(this).attr('href')){
window.location.href = $(this).attr('href');
}
else{
if($(this).parent().hasClass('open')){
location.assign($(this).attr('href'));
}
}
});
/*************** Sidebarmenu click script ***************/
$('ul.ttr_vmenu_items.nav li [data-toggle=dropdown]').on('click', function() {
var window_width = Math.max(document.documentElement.clientWidth, window.innerWidth || 0)
if(window_width > 1025 && $(this).attr('href')){
window.location.href = $(this).attr('href');
}
else{
if($(this).parent().hasClass('open')){
location.assign($(this).attr('href'));
}
}
});
/*************** Tab menu click script ***************/
$('.ttr_menu_items ul.dropdown-menu [data-toggle=dropdown]').on('click', function(event) {
var window_width = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
if(window_width < 1025){
event.preventDefault();
event.stopPropagation();
$(this).parent().siblings().removeClass('open');
$(this).parent().toggleClass(function() {
if ($(this).is(".open") ) {
window.location.href = $(this).children("[data-toggle=dropdown]").attr('href');
return "";
} else {
return "open";
}
});
}
});
/*************** Page Alignment format tab script ***************/
var page_width = $('#ttr_page').width();
var window_width = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
if(window_width < 1025){
$('.ttr_page_align_left').each(function() {
var left_div_width = $(this).width();
var page_align_left_value = page_width - left_div_width;
left_div_width = left_div_width + 1;
$(this).css({'left' : '-' + page_align_left_value + 'px', 'width': left_div_width + 'px'});
});
$('.ttr_page_align_right').each(function() {
var right_div_width = $(this).width();
var page_align_left_value = page_width - right_div_width;
right_div_width = right_div_width + 1;
$(this).css({'right' : '-' + page_align_left_value + 'px', 'width': right_div_width + 'px'});
});
}
/*************** Tab-Sidebarmenu script ***************/
$('.ttr_vmenu_items ul.dropdown-menu [data-toggle=dropdown]').on('click', function(event) {
var window_width = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
if(window_width < 1025){
event.preventDefault();
event.stopPropagation();
$(this).parent().siblings().removeClass('open');
$(this).parent().toggleClass(function() {
if ($(this).is(".open") ) {
window.location.href = $(this).children("[data-toggle=dropdown]").attr('href');
return "";
} else {
return "open";
}
});
}
});
/*************** Sticky menu script ***************/
var menutop = $('#ttr_menu').offset().top;
$(window).scroll(function () {
if ($(this).scrollTop() > menutop) {
$('#ttr_menu').addClass('navbar-fixed-top');
} else {
$('#ttr_menu').removeClass('navbar-fixed-top');
}
});
/*************** Html video script ***************/
var objects = ['iframe[src*="youtube.com"]','iframe[src*="youtu.be"]', 'video','object'];
for(var i = 0 ; i < objects.length ; i++){
if ($(objects[i]).length > 0) {
$(objects[i]).wrap( "<div class='embed-responsive embed-responsive-16by9'></div>" );
$(objects[i]).addClass('embed-responsive-item');
}
}
/*************** Html Equal column height ***************/
$(window).bind('load', function() { tt_columns(); });
$(window).resize(tt_columns);
});
/*************** Html Equal column height ***************/
function tt_equal_height(cols){
var maxHeight = 0;
maxHeight = Math.max.apply(Math, cols.map(function(){return $(this).height(); }).get());
cols.each(function(){
$child_h = $(this).children().outerHeight();
$parent_h = $(this).height();
if(maxHeight != $parent_h){
$(this).children().css('height','inherit');
if($child_h == $parent_h){
$(this).css('height', maxHeight+'px');
}
else{
$mrg = $parent_h - $child_h;
$m = maxHeight - $mrg;
$(this).css('height', $m + 'px');
}
}
});
}
function tt_columns(){
var window_width = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
$('#ttr_content .row').each(function() {
$child = $(this).children();
var col = [];
$k = 0;
var params = [];
for($i=0;$i<=$child.length;$i++){
$(params).css('height','auto');
if(window_width > 1199){
if($($child[$i]).hasClass('visible-lg-block')){
if( params.length > 1) {
tt_equal_height($(params));
}
params = [];
$k = 0;
}
else if($($child[$i]).hasClass('post_column')){
params[$k] = $child[$i];
$k++;
}
else if(!($($child[$i]).hasClass('clearfix'))) {
tt_equal_height($(params));
}
}
if(window_width > 767 && window_width < 1199){
if($($child[$i]).hasClass('visible-sm-block')){
if( params.length > 1) {
tt_equal_height($(params));
}
params = [];
$k = 0;
}
else if($($child[$i]).hasClass('post_column')){
params[$k] = $child[$i];
$k++;
}
else if(!($($child[$i]).hasClass('clearfix'))) {
tt_equal_height($(params));
}
}
if(window_width < 768){
if($($child[$i]).hasClass('visible-xs-block')){
if( params.length > 1) {
tt_equal_height($(params));
}
params = [];
$k = 0;
}
else if($($child[$i]).hasClass('post_column')){
params[$k] = $child[$i];
$k++;
}
else if(!($($child[$i]).hasClass('clearfix'))) {
tt_equal_height($(params));
}
}
}
});
}