-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscripts.js
120 lines (99 loc) · 3.69 KB
/
scripts.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
/**
* @file
* Add Drupal functions.
*/
(function (window, document, $) {
"use strict";
function add_attribute_menu () {
var width = window.innerWidth || document.documentElement.clientWidth;
if(width <= 767) {
$('.navbar-nav .expanded').each(function() {
if(!$(this).children('.dropdown-toggle').next().hasClass('caret')) {
$(this).children('.dropdown-toggle').after("<span class='libre-caret caret'></span>");
}
});
}
else {
$('.navbar-nav .expanded').each(function() {
if($(this).children('.dropdown-toggle').next().hasClass('caret')) {
$(this).children('.dropdown-toggle').next().remove();
}
});
}
}
// Add icon login.
function add_icon_account () {
$('.user-logged-in #block-projectlibre-account-menu .menu').before("<span class='account'></span>");
$('.branding #block-projectlibre-account-menu .account').click(function() {
//alert('ok');
$('.branding #block-projectlibre-account-menu .navbar-nav').toggleClass('active');
$('.navbar-collapse').removeClass('in');
});
$('.branding .navbar-toggle').click(function() {
$('.branding #block-projectlibre-account-menu .navbar-nav').removeClass('active');
});
}
// Add active menu.
function menu_Active () {
var url = window.location;
// Will only work if string in href matches with location
$('.navbar-nav a[href="'+ url +'"]').addClass('is-active');
// Will also work for relative and absolute hrefs
$('.navbar-nav a').filter(function() {
return this.href == url;
}).addClass('is-active');
}
// Width media box
function width_media_box () {
var width = window.innerWidth || document.documentElement.clientWidth;
if(width <= 767) {
$('.media-box__items').each(function() {
var width_img = $(this).find('> .media-box__items__img').outerWidth();
var width_content = $(this).find('> .media-box__content').outerWidth();
if (width_img <= width_content) {
$(this).find('> .media-box__content').outerWidth(width_img);
}
});
} else {
$('.media-box__content').css({'width': 'auto'});
}
}
$(window).load(function () {
$(".box-service .box-service__items__img").equalHeight().Height();
$(".clients .clients__item__image").equalHeight().Height();
$(".testimonial .testimonial__logo").equalHeight().Height();
$(".media-box.media-box--wide .media-box__content").equalHeight().Height();
$(".path-register .cta-register, .path-register .register-trail-form").equalHeight().Height();
$("#block-projectlibre-account-menu").clone().appendTo(".branding");
var width = window.innerWidth || document.documentElement.clientWidth;
if(width > 767) {
$(".footer .footer-panel").equalHeight().Height();
}
$("#owl-demo").owlCarousel({
autoPlay: 5000,
items : 1,
itemsDesktop : [1199,1],
itemsDesktopSmall : [979,1],
itemsTablet : [768, 1],
});
var laber_title = $('.view-filters .form-item-title .control-label').text();
$('.view-filters .form-item-title .form-text').attr("placeholder", laber_title);
$('#myModal').on('hidden.bs.modal', function (e) {
var videoCta = $(".cta__content").find('iframe'),
currentSrc = videoCta.attr('src');
videoCta.attr('src',currentSrc);
});
$('body').on('click', '.libre-caret', function() {
$(this).parent().toggleClass('open');
});
add_attribute_menu();
add_icon_account();
menu_Active();
width_media_box();
// Resize windows.
$(window).resize(function () {
add_attribute_menu();
width_media_box();
});
});
})(this, this.document, this.jQuery);