common.js
2.91 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
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
$(function() {
$('.scrollup').click(function() {
$("html, body").animate({
scrollTop:0
},1000);
})
})
$(window).scroll(function() {
if ($(this).scrollTop()>200) {
$('.scrollup').fadeIn();
}
else {
$('.scrollup').fadeOut("slow");
}
});
$(document).ready(function(){
//главное меню
$('.navbar-top-bottom .nav-item div').each(function(i,elem) {
if($(this).hasClass("dropdown-menu")){
$(this).parent().children( "a" ).attr('role', 'button').attr('data-toggle', 'dropdown').attr('aria-haspopup', 'true').attr('aria-expanded', 'false')
$(this).parent().addClass('dropdown')
}
})
//Left menu
$('.panel>div').each(function(i,elem) {
if($(this).hasClass("panel-body")){
var id="collapse"+i;
$(this).parent().children( ".heading").addClass('panel-heading').removeClass("panel-h")
$(this).parent().children( ".heading" ).children( ".panel-title" ).children( "a" ).attr('role', 'button').attr('data-toggle', 'dropdown').attr('data-toggle', 'collapse').attr('aria-expanded', 'false').attr('aria-controls', id).attr('data-parent', '#'+id).attr("href", "#"+id)
$(this).attr('id', id)
}
})
//активный пункт Top menu
$(function () {
var cur_url = window.location.pathname;
$('.navbar-top-bottom li').each(function () {
var link = $(this).find('a').attr('href');
if (cur_url == link)
{
$(this).find("a").addClass('active');
}
});
});
//активный пункт Top menu dropdown
$(function () {
var cur_url = window.location.pathname;
$('.navbar-top-bottom .dropdown .dropdown-menu a').each(function () {
var link = $(this).attr('href');
console.log(link)
if (cur_url == link)
{
$(this).addClass('active');
$(this).parents('.nav-item').children( "a" ).addClass('active');
}
});
});
//активный пункт Left menu
$(function () {
var cur_url = window.location.pathname;
$('#sidebar #accordionMenu .panel-title').each(function () {
var link = $(this).find('a').attr('href');
if (cur_url == link)
{
$(this).find("a").addClass('active');
$(this).parents('.panel').children( ".heading" ).find("a").addClass('active').attr("aria-expanded", "true");;
$(this).parents('.panel-body').addClass('show');
}
});
});
//активный пункт Left menu dropdown
/*$(function () {
var cur_url = window.location.pathname;
$('#sidebar #accordionMenu .panel-title').each(function () {
var link = $(this).attr('href');
if (cur_url == link)
{
$(this).find("a").addClass('active');
$(this).parents('.panel').addClass('active');
//$(this).closest('panel-heading').addClass('active');
}
});
});*/
});
/*animation*/
new WOW().init();