forked from HubSpot/codegallery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
code.js
51 lines (41 loc) · 2.25 KB
/
code.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
$(document).ready(function() {
hsjQuery(".header-23-play").each(function(){
var o = $(this);
var m = /wistia.com\/medias\/(.+)/.exec(o.attr("href"));
if (m) {
var id = m[1];
o.attr("href", "//fast.wistia.net/embed/iframe/" + id + (id.indexOf("?") > -1 ? "&" : "?") + "autoPlay=true");
}
}).magnificPopup({
"type": "iframe",
mainClass: "header-23-popup"
});
});
jQuery(document).ready(function($) {
$(".header-23-v2").each(function() {
var o = $(this);
if (o.hasClass("init")) {
return;
}
o.addClass("init");
var headerId = "id-" + Math.random().toString().slice(2);
o.attr("id", headerId);
var style = "";
o.find(".js-nav-styles").each(function(){
var parentMenuColor = $( this ).data( 'nav-parent-color' );
var parentMenuHoverColor = $( this ).data( 'nav-parent-hover-color' );
var childMenuColor = $( this ).data( 'nav-child-color' );
var childMenuHoverColor = $( this ).data( 'nav-child-hover-color' );
var childMenuBgColor = $( this ).data( 'nav-child-bg' );
var navId = "id-" + Math.random().toString().slice(2);
$(this).attr("id", navId);
style += "#" + navId + " ul > li > a { color: " + parentMenuColor + "; } \n";
style += "#" + navId + " ul > li > a:hover, #" + navId + " ul > li > a:focus, #" + navId + " ul > li > a:active { color: " + parentMenuHoverColor + "; } \n";
style += "#" + navId + " ul > li > .hs-menu-children-wrapper li a { color: " + childMenuColor + "; } \n";
style += "#" + navId + " ul > li > .hs-menu-children-wrapper li a:hover, #" + navId + " ul > li > .hs-menu-children-wrapper li a:focus, #" + navId + " ul > li > .hs-menu-children-wrapper li a:active { color: " + childMenuHoverColor + "; } \n";
style += "#" + navId + " ul > li > .hs-menu-children-wrapper { background-color: " + childMenuBgColor + "; } \n";
style += "#" + headerId + " .navbar-toggle .icon-bar { background-color: " + parentMenuColor + "; } \n";
});
$("<style type='text/css'/>").html(style).appendTo("head");
});
});