new_script.js
4.54 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
$(document).ready(function () {
showSubMenu();
activeSubMEnu();
allSeoTxt();
loadNewCarousel();
function showSubMenu() {
var timeout;
var timeout2;
$('.new_catalog').hover(function () {
var this_ = $(this)
timeout = setTimeout(function () {
this_.addClass('show')
if(!$('.main-cat_ ul li.act').length) {
$('.main-cat_ ul li:first-child').addClass('act')
$('.sub-cat_ ul:first-child').addClass('active-show')
}
},200)
clearTimeout(timeout2)
},function () {
var this_ = $(this)
clearTimeout(timeout)
timeout2 = setTimeout(function () {
this_.removeClass('show')
$('.main-cat_ ul li').removeClass('act')
$('.sub-cat_ ul').removeClass('active-show')
},200)
})
}
function activeSubMEnu() {
var timeout;
var timeout2;
$('.main-cat_ ul li').hover(function () {
var this_ = $(this)
var thisIndex = this_.index()
var subIndex = $('.sub-cat_ ul')
timeout = setTimeout(function () {
$('.main-cat_ ul li').removeClass('act')
this_.addClass('act')
$('.sub-cat_ ul').removeClass('active-show')
$(subIndex[thisIndex]).addClass('active-show')
},200)
clearTimeout(timeout2)
},function () {
clearTimeout(timeout)
})
}
function allSeoTxt() {
var txt1 = 'Развернуть текст';
var txt2 = 'Свернуть';
$('.all_seo_text').click(function (e) {
e.preventDefault()
$('.seo-text').toggleClass('show')
$(this).toggleClass('show')
if($(this).hasClass('show')) {
$(this).html(txt2)
} else {$(this).html(txt1)}
})
}
function loadNewCarousel() {
$('.home-popular li a').click(function (e) {
e.preventDefault();
$('.home-popular li a').parent().removeClass('active')
$(this).parent().addClass('active');
var status = $(this).data('status')
switch (status) {
case 'new':
$.post( "/ajax/new",function( data ) {
$('.home-popular-slider').html(data);
$('#product_main_slider').owlCarousel({
navigation:true,
navigationText: [],
responsiveClass: true,
loop:true,
items:4,
mouseDrag:false,
navSpeed:200,
})
});
break;
case 'top':
$.post( "/ajax/top", function( data ) {
$('.home-popular-slider').html(data);
$('#product_main_slider').owlCarousel({
navigation:true,
navigationText: [],
responsiveClass: true,
loop:true,
items:4,
mouseDrag:false,
navSpeed:200,
})
});
break;
case 'prom':
$.post( "/ajax/prom", function( data ) {
$('.home-popular-slider').html(data);
$('#product_main_slider').owlCarousel({
navigation:true,
navigationText: [],
responsiveClass: true,
loop:true,
items:4,
mouseDrag:false,
navSpeed:200,
})
});
break;
}
})
}
$('.collection .new_collection').owlCarousel({
navigation : true, // Show next and prev buttons
slideSpeed : 500,
autoplayTimeout:3000,
paginationSpeed : 1000,
items:3,
responsiveClass: true,
responsive: {
0: {
items: 2,
slideBy: 1
},
1200: {
items: 2,
slideBy: 1
}
}
});
})