forked from magento/devdocs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevdocs.js
99 lines (82 loc) · 2.47 KB
/
devdocs.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
$(document).ready(function(){
if(getURLParameter("cx"))
showSearchBox();
$('#searchbox').submit(function(event) {
showSearchBox();
});
$('#gsc-search-box').submit(function(){
$('input').blur();
});
$('.search-trigger').click(function () {
showSearchBox();
});
$('DIV.searchResultsBoxClose').click(function(){
hideSearchBox();
});
// ** Menu **
var menustate ="";
if ( $('LI.level3Child').is("LI.active")) {
menustate = $('LI.active').attr('data-menunode');
$('#' + menustate).show(); //show parent
$('#' + menustate).removeClass('caretRight').addClass('caretDown') //submenu open indication
$('.' + menustate).show(); //show submenu
}
var thirdTier = "";
$('.level3Parent').click(function(){
thirdTier = $(this).attr('id');
if($('.' + thirdTier).is(":visible")) {
$(this).removeClass('caretDown').addClass('caretRight')
$('.' + thirdTier).slideUp(200);
} else {
$(this).removeClass('caretRight').addClass('caretDown')
$('.' + thirdTier).slideDown(200);
}
return false;
});
//All divs with classname "collapsible" will have jquery-ui accordion functionality
$(".collapsible").accordion({
collapsible: true,
active: false,
icons: { "header": "collapsible-ready", "activeHeader": "collapsible-active" },
header: ".collapsible-title",
heightStyle: "content"
});
});
//Allows for sticky menu
$(document).scroll(function(){
if($(document).scrollTop()>66)
$("#subnav-wrap").addClass("sticky-nav-main");
else
$("#subnav-wrap").removeClass("sticky-nav-main");
})
//Function to get URL parameter values
function getURLParameter(sParam) {
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam)
{
return sParameterName[1];
}
}
}
function showSearchBox () {
$('#searchResultsBox').fadeIn(300, function () {
// Callback function that focuses on input
$('#searchResultsBox input.gsc-input').first().focus();
});
$('.searchResultsBack').fadeIn(300);
$.cookie('searchResultsState', '1');
$('body').addClass('search-active');
}
function hideSearchBox () {
$('#searchResultsBox').fadeOut(300, function () {
// Callback function that focuses out of input
$('#searchResultsBox input.gsc-input').first().blur();
});
$('.searchResultsBack').fadeOut(300);
$.cookie('searchResultsState','0');
$('body').removeClass('search-active');
}