- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
// weclome to main-menu-hover.js
function load(){
var url = window.location;
var m1 = document.getElementById("m1");
var m2 = document.getElementById("m2");
var m3 = document.getElementById("m3");
var m4 = document.getElementById("m4");
//var m5 = document.getElementById("m5");
var mm1 = document.getElementById("mm1");
var mm2 = document.getElementById("mm2");
var mm3 = document.getElementById("mm3");
var mm4 = document.getElementById("mm4");
var mm5 = document.getElementById("mm5");
var mm6 = document.getElementById("mm6");
var mm7 = document.getElementById("mm7");
var mm8 = document.getElementById("mm8");
if (m1.href == url){
m1.style.color = "#ffc12b";
//m1.style.background = "url(%absolute_url_path%/wp-content/themes/%pattern%/images/menu-h-bg1.png)no-repeat top center";
m1.style.textDecoration = "none";
}
if (m2.href == url){
m2.style.color = "#ffc12b";
m2.style.background = "url(%absolute_url_path%/wp-content/themes/%pattern%/images/menu-h-bg1.png)no-repeat center center";
m2.style.textDecoration = "none";
}
if (m3.href == url){
m3.style.color = "#ffc12b";
m3.style.background = "url(%absolute_url_path%/wp-content/themes/%pattern%/images/menu-h-bg1.png)no-repeat center center";
m3.style.textDecoration = "none";
}
if (m4.href == url){
m4.style.color = "#ffc12b";
m4.style.background = "url(%absolute_url_path%/wp-content/themes/%pattern%/images/menu-h-bg1.png)no-repeat center center";
m4.style.textDecoration = "none";
}
if (m5.href == url || url.href.indexOf(m5.href)!=-1){
m5.style.color = "#ffc12b";
m5.style.background = "url(%absolute_url_path%/wp-content/themes/%pattern%/images/menu-h-bg2.png)no-repeat center center";
m5.style.textDecoration = "none";
}
if (url.href.indexOf(mm1.href)!=-1){
mm1.style.color = "#741f0c";
mm1.style.background = "url(%absolute_url_path%/wp-content/themes/%pattern%/images/bg-min-menu-h.png)no-repeat center center";
m3.style.color = "#ffc12b";
m3.style.background = "url(%absolute_url_path%/wp-content/themes/%pattern%/images/menu-h-bg1.png)no-repeat center center";
m3.style.textDecoration = "none";
}
if (url.href.indexOf(mm2.href)!=-1){
mm2.style.color = "#741f0c";
mm2.style.background = "url(%absolute_url_path%/wp-content/themes/%pattern%/images/bg-min-menu-h.png)no-repeat center center";
m3.style.color = "#ffc12b";
m3.style.background = "url(%absolute_url_path%/wp-content/themes/%pattern%/images/menu-h-bg1.png)no-repeat center center";
m3.style.textDecoration = "none";
}
if (url.href.indexOf(mm3.href)!=-1){
mm3.style.color = "#741f0c";
mm3.style.background = "url(%absolute_url_path%/wp-content/themes/%pattern%/images/bg-min-menu-h.png)no-repeat center center";
m3.style.color = "#ffc12b";
m3.style.background = "url(%absolute_url_path%/wp-content/themes/%pattern%/images/menu-h-bg1.png)no-repeat center center";
m3.style.textDecoration = "none";
}
if (url.href.indexOf(mm4.href)!=-1){
mm4.style.color = "#741f0c";
mm4.style.background = "url(%absolute_url_path%/wp-content/themes/%pattern%/images/bg-min-menu-h.png)no-repeat center center";
m3.style.color = "#ffc12b";
m3.style.background = "url(%absolute_url_path%/wp-content/themes/%pattern%/images/menu-h-bg1.png)no-repeat center center";
m3.style.textDecoration = "none";
}
if (url.href.indexOf(mm5.href)!=-1){
mm5.style.color = "#741f0c";
mm5.style.background = "url(%absolute_url_path%/wp-content/themes/%pattern%/images/bg-min-menu-h.png)no-repeat center center";
m3.style.color = "#ffc12b";
m3.style.background = "url(%absolute_url_path%/wp-content/themes/%pattern%/images/menu-h-bg1.png)no-repeat center center";
m3.style.textDecoration = "none";
}
if (url.href.indexOf(mm6.href)!=-1){
mm6.style.color = "#741f0c";
mm6.style.background = "url(%absolute_url_path%/wp-content/themes/%pattern%/images/bg-min-menu-h.png)no-repeat center center";
m3.style.color = "#ffc12b";
m3.style.background = "url(%absolute_url_path%/wp-content/themes/%pattern%/images/menu-h-bg1.png)no-repeat center center";
m3.style.textDecoration = "none";
}
if (url.href.indexOf(mm7.href)!=-1){
mm7.style.color = "#741f0c";
mm7.style.background = "url(%absolute_url_path%/wp-content/themes/%pattern%/images/bg-min-menu-h.png)no-repeat center center";
m3.style.color = "#ffc12b";
m3.style.background = "url(%absolute_url_path%/wp-content/themes/%pattern%/images/menu-h-bg1.png)no-repeat center center";
m3.style.textDecoration = "none";
}
if (url.href.indexOf(mm8.href)!=-1){
mm8.style.color = "#741f0c";
mm8.style.background = "url(%absolute_url_path%/wp-content/themes/%pattern%/images/bg-min-menu-h.png)no-repeat center center";
m3.style.color = "#ffc12b";
m3.style.background = "url(%absolute_url_path%/wp-content/themes/%pattern%/images/menu-h-bg1.png)no-repeat center center";
m3.style.textDecoration = "none";
}
}
Пришел проект на поддержку... Сразу отказался=)
Естественно вкрапления %_some_text_% от меня.
Файл назывался main-menu-hover.js
Vasiliy 30.05.2014 13:55 # −1
Lure Of Chaos 01.06.2014 11:14 # +2
Oliver_air 02.06.2014 15:13 # +1
bormand 02.06.2014 15:28 # +1
iHateBidlocod 07.07.2014 18:50 # 0
1024-- 07.07.2014 20:45 # +1
Для удобства переиспользования?
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на github for dummies, ведь оно как-то работает и точно кому-то пригодится!
guest 04.07.2014 19:26 # +1