This repository was archived by the owner on Feb 24, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.js
565 lines (478 loc) · 15.7 KB
/
main.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
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
$(document).ready(function(){
"use strict";
var window_width = $(window).width(),
window_height = window.innerHeight,
header_height = $(".default-header").height(),
header_height_static = $(".site-header.static").outerHeight(),
fitscreen = window_height - header_height;
$(".fullscreen").css("height", window_height)
$(".fitscreen").css("height", fitscreen);
//------- Active Nice .filter-barelect --------//
$('select').niceSelect();
$('.navbar-nav li.dropdown').hover(function() {
$(this).find('.dropdown-menu').stop(true, true).delay(200).fadeIn(500);
}, function() {
$(this).find('.dropdown-menu').stop(true, true).delay(200).fadeOut(500);
});
$('.img-pop-up').magnificPopup({
type: 'image',
gallery:{
enabled:true
}
});
// Search Toggle
$("#search_input_box").hide();
$("#search").on("click", function () {
$("#search_input_box").slideToggle();
$("#search_input").focus();
});
$("#close_search").on("click", function () {
$('#search_input_box').slideUp(500);
});
/*==========================
javaScript for sticky header
============================*/
$(".sticky-header").sticky();
/*=================================
Javascript for banner area carousel
==================================*/
$(".active-banner-slider").owlCarousel({
items:1,
autoplay:false,
autoplayTimeout: 5000,
loop:true,
nav:true,
navText:["<img src='img/banner/prev.png'>","<img src='img/banner/next.png'>"],
dots:false
});
/*=================================
Javascript for product area carousel
==================================*/
$(".active-product-area").owlCarousel({
items:1,
autoplay:false,
autoplayTimeout: 5000,
loop:true,
nav:true,
navText:["<img src='img/banner/prev.png'>","<img src='img/banner/next.png'>"],
dots:false
});
/*=================================
Javascript for single product area carousel
==================================*/
$(".s_Product_carousel").owlCarousel({
items:1,
autoplay:false,
autoplayTimeout: 5000,
loop:true,
nav:false,
dots:true
});
/*=================================
Javascript for exclusive area carousel
==================================*/
$(".active-exclusive-product-slider").owlCarousel({
items:1,
autoplay:false,
autoplayTimeout: 5000,
loop:true,
nav:true,
navText:["<img src='img/product/prev.png'>","<img src='img/product/next.png'>"],
dots:false
});
//--------- Accordion Icon Change ---------//
$('.collapse').on('shown.bs.collapse', function(){
$(this).parent().find(".lnr-arrow-right").removeClass("lnr-arrow-right").addClass("lnr-arrow-left");
}).on('hidden.bs.collapse', function(){
$(this).parent().find(".lnr-arrow-left").removeClass("lnr-arrow-left").addClass("lnr-arrow-right");
});
// Select all links with hashes
$('.main-menubar a[href*="#"]')
// Remove links that don't actually link to anything
.not('[href="#"]')
.not('[href="#0"]')
.click(function(event) {
// On-page links
if (
location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '')
&&
location.hostname == this.hostname
) {
// Figure out element to scroll to
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
// Does a scroll target exist?
if (target.length) {
// Only prevent default if animation is actually gonna happen
event.preventDefault();
$('html, body').animate({
scrollTop: target.offset().top-70
}, 1000, function() {
// Callback after animation
// Must change focus!
var $target = $(target);
$target.focus();
if ($target.is(":focus")) { // Checking if the target was focused
return false;
} else {
$target.attr('tabindex','-1'); // Adding tabindex for elements not focusable
$target.focus(); // Set focus again
};
});
}
}
});
// ------- Mail Send ajax
$(document).ready(function() {
var form = $('#booking'); // contact form
var submit = $('.submit-btn'); // submit button
var alert = $('.alert-msg'); // alert div for show alert message
// form submit event
form.on('submit', function(e) {
e.preventDefault(); // prevent default form submit
$.ajax({
url: 'booking.php', // form action url
type: 'POST', // form submit method get/post
dataType: 'html', // request type html/json/xml
data: form.serialize(), // serialize form data
beforeSend: function() {
alert.fadeOut();
submit.html('Sending....'); // change submit button text
},
success: function(data) {
alert.html(data).fadeIn(); // fade in response data
form.trigger('reset'); // reset form
submit.attr("style", "display: none !important");; // reset submit button text
},
error: function(e) {
console.log(e)
}
});
});
});
$(document).ready(function() {
$('#mc_embed_signup').find('form').ajaxChimp();
});
if(document.getElementById("js-countdown")){
var countdown = new Date("October 17, 2018");
function getRemainingTime(endtime) {
var milliseconds = Date.parse(endtime) - Date.parse(new Date());
var seconds = Math.floor(milliseconds / 1000 % 60);
var minutes = Math.floor(milliseconds / 1000 / 60 % 60);
var hours = Math.floor(milliseconds / (1000 * 60 * 60) % 24);
var days = Math.floor(milliseconds / (1000 * 60 * 60 * 24));
return {
'total': milliseconds,
'seconds': seconds,
'minutes': minutes,
'hours': hours,
'days': days
};
}
function initClock(id, endtime) {
var counter = document.getElementById(id);
var daysItem = counter.querySelector('.js-countdown-days');
var hoursItem = counter.querySelector('.js-countdown-hours');
var minutesItem = counter.querySelector('.js-countdown-minutes');
var secondsItem = counter.querySelector('.js-countdown-seconds');
function updateClock() {
var time = getRemainingTime(endtime);
daysItem.innerHTML = time.days;
hoursItem.innerHTML = ('0' + time.hours).slice(-2);
minutesItem.innerHTML = ('0' + time.minutes).slice(-2);
secondsItem.innerHTML = ('0' + time.seconds).slice(-2);
if (time.total <= 0) {
clearInterval(timeinterval);
}
}
updateClock();
var timeinterval = setInterval(updateClock, 1000);
}
initClock('js-countdown', countdown);
};
$('.quick-view-carousel-details').owlCarousel({
loop: true,
dots: true,
items: 1,
})
//----- Active No ui slider --------//
$(function(){
if(document.getElementById("price-range")){
var nonLinearSlider = document.getElementById('price-range');
noUiSlider.create(nonLinearSlider, {
connect: true,
behaviour: 'tap',
start: [ 500, 4000 ],
range: {
// Starting at 500, step the value by 500,
// until 4000 is reached. From there, step by 1000.
'min': [ 0 ],
'10%': [ 500, 500 ],
'50%': [ 4000, 1000 ],
'max': [ 10000 ]
}
});
var nodes = [
document.getElementById('lower-value'), // 0
document.getElementById('upper-value') // 1
];
// Display the slider value and how far the handle moved
// from the left edge of the slider.
nonLinearSlider.noUiSlider.on('update', function ( values, handle, unencoded, isTap, positions ) {
nodes[handle].innerHTML = values[handle];
});
}
});
//-------- Have Cupon Button Text Toggle Change -------//
$('.have-btn').on('click', function(e){
e.preventDefault();
$('.have-btn span').text(function(i, text){
return text === "Have a Coupon?" ? "Close Coupon" : "Have a Coupon?";
})
$('.cupon-code').fadeToggle("slow");
});
$('.load-more-btn').on('click', function(e){
e.preventDefault();
$('.load-product').fadeIn('slow');
$(this).fadeOut();
});
//------- Start Quantity Increase & Decrease Value --------//
var value,
quantity = document.getElementsByClassName('quantity-container');
function createBindings(quantityContainer) {
var quantityAmount = quantityContainer.getElementsByClassName('quantity-amount')[0];
var increase = quantityContainer.getElementsByClassName('increase')[0];
var decrease = quantityContainer.getElementsByClassName('decrease')[0];
increase.addEventListener('click', function () { increaseValue(quantityAmount); });
decrease.addEventListener('click', function () { decreaseValue(quantityAmount); });
}
function init() {
for (var i = 0; i < quantity.length; i++ ) {
createBindings(quantity[i]);
}
};
function increaseValue(quantityAmount) {
value = parseInt(quantityAmount.value, 10);
console.log(quantityAmount, quantityAmount.value);
value = isNaN(value) ? 0 : value;
value++;
quantityAmount.value = value;
}
function decreaseValue(quantityAmount) {
value = parseInt(quantityAmount.value, 10);
value = isNaN(value) ? 0 : value;
if (value > 0) value--;
quantityAmount.value = value;
}
init();
//------- End Quantity Increase & Decrease Value --------//
/*----------------------------------------------------*/
/* Google map js
/*----------------------------------------------------*/
if ($("#mapBox").length) {
var $lat = $("#mapBox").data("lat");
var $lon = $("#mapBox").data("lon");
var $zoom = $("#mapBox").data("zoom");
var $marker = $("#mapBox").data("marker");
var $info = $("#mapBox").data("info");
var $markerLat = $("#mapBox").data("mlat");
var $markerLon = $("#mapBox").data("mlon");
var map = new GMaps({
el: "#mapBox",
lat: $lat,
lng: $lon,
scrollwheel: false,
scaleControl: true,
streetViewControl: false,
panControl: true,
disableDoubleClickZoom: true,
mapTypeControl: false,
zoom: $zoom,
styles: [
{
featureType: "water",
elementType: "geometry.fill",
stylers: [
{
color: "#dcdfe6"
}
]
},
{
featureType: "transit",
stylers: [
{
color: "#808080"
},
{
visibility: "off"
}
]
},
{
featureType: "road.highway",
elementType: "geometry.stroke",
stylers: [
{
visibility: "on"
},
{
color: "#dcdfe6"
}
]
},
{
featureType: "road.highway",
elementType: "geometry.fill",
stylers: [
{
color: "#ffffff"
}
]
},
{
featureType: "road.local",
elementType: "geometry.fill",
stylers: [
{
visibility: "on"
},
{
color: "#ffffff"
},
{
weight: 1.8
}
]
},
{
featureType: "road.local",
elementType: "geometry.stroke",
stylers: [
{
color: "#d7d7d7"
}
]
},
{
featureType: "poi",
elementType: "geometry.fill",
stylers: [
{
visibility: "on"
},
{
color: "#ebebeb"
}
]
},
{
featureType: "administrative",
elementType: "geometry",
stylers: [
{
color: "#a7a7a7"
}
]
},
{
featureType: "road.arterial",
elementType: "geometry.fill",
stylers: [
{
color: "#ffffff"
}
]
},
{
featureType: "road.arterial",
elementType: "geometry.fill",
stylers: [
{
color: "#ffffff"
}
]
},
{
featureType: "landscape",
elementType: "geometry.fill",
stylers: [
{
visibility: "on"
},
{
color: "#efefef"
}
]
},
{
featureType: "road",
elementType: "labels.text.fill",
stylers: [
{
color: "#696969"
}
]
},
{
featureType: "administrative",
elementType: "labels.text.fill",
stylers: [
{
visibility: "on"
},
{
color: "#737373"
}
]
},
{
featureType: "poi",
elementType: "labels.icon",
stylers: [
{
visibility: "off"
}
]
},
{
featureType: "poi",
elementType: "labels",
stylers: [
{
visibility: "off"
}
]
},
{
featureType: "road.arterial",
elementType: "geometry.stroke",
stylers: [
{
color: "#d6d6d6"
}
]
},
{
featureType: "road",
elementType: "labels.icon",
stylers: [
{
visibility: "off"
}
]
},
{},
{
featureType: "poi",
elementType: "geometry.fill",
stylers: [
{
color: "#dadada"
}
]
}
]
});
}
});