$(function () {
'use strict';
// Showing page loader
$(window).load(function () {
setTimeout(function () {
$(".page_loader").fadeOut("fast");
}, 100)
$('link[id="style_sheet"]').attr('href', '/css/skins/default.css');
$('.logo img').attr('src', 'img/logos/logo.png');
// Filterizr initialization
if($('.filtr-container').length > 0) {
$(function () {
$('.filtr-container').filterizr(
{
delay: 1
}
);
});
}
$('.filters-listing-navigation li').click(function() {
$('.filters-listing-navigation .filtr').removeClass('active');
$(this).addClass('active');
});
});
// WOW animation library initialization
var wow = new WOW(
{
animateClass: 'animated',
offset: 100,
mobile: false
}
);
wow.init();
// Page scroller initialization.
$.scrollUp({
scrollName: 'page_scroller',
scrollDistance: 300,
scrollFrom: 'top',
scrollSpeed: 500,
easingType: 'linear',
animation: 'fade',
animationSpeed: 200,
scrollTrigger: false,
scrollTarget: false,
scrollText: '',
scrollTitle: false,
scrollImg: false,
activeOverlay: false,
zIndex: 2147483647
});
// Counter
function isCounterElementVisible($elementToBeChecked) {
var TopView = $(window).scrollTop();
var BotView = TopView + $(window).height();
var TopElement = $elementToBeChecked.offset().top;
var BotElement = TopElement + $elementToBeChecked.height();
return ((BotElement <= BotView) && (TopElement >= TopView));
}
$(window).scroll(function () {
$(".counter").each(function () {
var isOnView = isCounterElementVisible($(this));
if (isOnView && !$(this).hasClass('Starting')) {
$(this).addClass('Starting');
$(this).prop('Counter', 0).animate({
Counter: $(this).text()
}, {
duration: 3000,
easing: 'swing',
step: function (now) {
$(this).text(Math.ceil(now));
}
});
}
});
});
/*
// Range sliders initialization
$(".range-slider-ui").each(function () {
var minRangeValue = $(this).attr('data-min');
var maxRangeValue = $(this).attr('data-max');
var minName = $(this).attr('data-min-name');
var maxName = $(this).attr('data-max-name');
var unit = $(this).attr('data-unit');
$(this).append("" +
" " +
"" +
"" +
""
);
$(this).slider({
range: true,
min: minRangeValue,
max: maxRangeValue,
values: [minRangeValue, maxRangeValue],
slide: function (event, ui) {
event = event;
var currentMin = parseInt(ui.values[0]);
var currentMax = parseFloat(ui.values[1]);
$(this).children(".min-value").text( currentMin + " " + unit);
$(this).children(".max-value").text(currentMax + " " + unit);
$(this).children(".current-min").val(currentMin);
$(this).children(".current-max").val(currentMax);
}
});
var currentMin = parseInt($(this).slider("values", 0));
var currentMax = parseFloat($(this).slider("values", 1));
$(this).children(".min-value").text( currentMin + " " + unit);
$(this).children(".max-value").text(currentMax + " " + unit);
$(this).children(".current-min").val(currentMin);
$(this).children(".current-max").val(currentMax);
});
*/
// Select picket
$('.selectpicker').selectpicker();
// Search option's icon toggle
$('.search-options-btn').click(function () {
$('.search-contents').toggleClass('show-search-area');
$('.search-options-btn .fa').toggleClass('fa-chevron-down');
});
// Carousel with partner initialization
(function () {
$('.our-partners .item').each(function () {
var itemToClone = $(this);
for (var i = 1; i < 4; i++) {
itemToClone = itemToClone.next();
if (!itemToClone.length) {
itemToClone = $(this).siblings(':first');
}
itemToClone.children(':first-child').clone()
.addClass("cloneditem-" + (i))
.appendTo($(this));
}
});
}());
// Background video playing script
$(document).ready(function () {
//$(".player").mb_YTPlayer();
});
// Multilevel menuus
$('[data-submenu]').submenupicker();
// Expending/Collapsing advance search content
$('.show-more-options').click(function () {
if ($(this).find('.fa').hasClass('fa-minus-circle')) {
$(this).find('.fa').removeClass('fa-minus-circle');
$(this).find('.fa').addClass('fa-plus-circle');
} else {
$(this).find('.fa').removeClass('fa-plus-circle');
$(this).find('.fa').addClass('fa-minus-circle');
}
});
var videoWidth = $('.sidebar-widget').width();
var videoHeight = videoWidth * .61;
$('.sidebar-widget iframe').css('height', videoHeight);
// Dropzone initialization
/*
Dropzone.autoDiscover = false;
$(function () {
$("div#myDropZone").dropzone({
url: "/file-upload"
});
});
*/
// SO something in mega menu
jQuery(document).on('click', '.mega-dropdown', function(e) {
e.stopPropagation()
})
// Magnify activation
$('.property-magnify-gallery').each(function() {
$(this).magnificPopup({
delegate: 'a',
type: 'image',
gallery:{enabled:true}
});
});
$('.portfolio-item').magnificPopup({
delegate: 'a',
type: 'image',
gallery:{enabled:true}
});
// Dropdown activation
$('.dropdown-menu a.dropdown-toggle').on('click', function(e) {
if (!$(this).next().hasClass('show')) {
$(this).parents('.dropdown-menu').first().find('.show').removeClass("show");
}
var $subMenu = $(this).next(".dropdown-menu");
$subMenu.toggleClass('show');
$(this).parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', function(e) {
$('.dropdown-submenu .show').removeClass("show");
});
return false;
});
// Partners strat
$('.custom-slider').slick({
slidesToShow: 5,
slidesToScroll: 1,
autoplay: true,
autoplaySpeed: 2000,
responsive: [
{
breakpoint: 1200,
settings: {
slidesToShow: 3,
slidesToScroll: 1,
infinite: true,
dots: false
}
},
{
breakpoint: 900,
settings: {
slidesToShow: 2,
slidesToScroll: 1,
infinite: true,
dots: false
}
},
{
breakpoint: 550,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
infinite: true,
dots: false
}
}
]
});
// Multilevel menuus
$('[data-submenu]').submenupicker();
// Megamenu activation
$(".megamenu").on("click", function (e) {
e.stopPropagation();
});
// Dropdown activation
$('.dropdown-menu a.dropdown-toggle').on('click', function(e) {
if (!$(this).next().hasClass('show')) {
$(this).parents('.dropdown-menu').first().find('.show').removeClass("show");
}
var $subMenu = $(this).next(".dropdown-menu");
$subMenu.toggleClass('show');
$(this).parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', function(e) {
$('.dropdown-submenu .show').removeClass("show");
});
return false;
});
// Comon slick strat
$('.slick').slick({
dots: false,
infinite: true,
touchThreshold : 100,
speed: 300,
slidesToShow: 3,
slidesToScroll: 3,
centerMode: true,
nextArrow: '',
prevArrow: '',
});
// Properties slider section
$('.slider-for').slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
fade: true,
asNavFor: '.slider-nav'
});
$('.slider-nav').slick({
slidesToShow: 5,
slidesToScroll: 1,
asNavFor: '.slider-for',
dots: true,
focusOnSelect: true
});
$('a[data-slide]').click(function(e) {
e.preventDefault();
var slideno = $(this).data('slide');
$('.slider-nav').slick('slickGoTo', slideno - 1);
});
//product-slider-box
$('.slider-for2').slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
fade: true,
asNavFor: '.slider-nav2'
});
$('.slider-nav2').slick({
slidesToShow: 4,
slidesToScroll: 1,
vertical:true,
asNavFor: '.slider-for2',
dots: false,
focusOnSelect: true,
verticalSwiping:true
});
//featured-slider
$('.slider').slick({
infinite: true,
slidesToShow: 3,
slidesToScroll: 1,
arrows: true,
autoplay: true,
autoplaySpeed: 2000,
});
// Header shrink while page scroll
adjustHeader();
doSticky();
placedDashboard();
$(window).on('scroll', function () {
adjustHeader();
doSticky();
placedDashboard();
});
// Header shrink while page resize
$(window).on('resize', function () {
adjustHeader();
doSticky();
placedDashboard();
});
function adjustHeader()
{
var windowWidth = $(window).width();
if(windowWidth > 0) {
if ($(document).scrollTop() >= 100) {
if($('.header-shrink').length < 1) {
$('.sticky-header').addClass('header-shrink');
}
if($('.do-sticky').length < 1) {
$('.logo img').attr('src', 'img/logos/logo.png');
}
}
else {
$('.sticky-header').removeClass('header-shrink');
if($('.do-sticky').length < 1 && $('.fixed-header').length == 0 && $('.fixed-header2').length == 0) {
$('.logo img').attr('src', 'img/logos/logo.png');
} else {
$('.logo img').attr('src', 'img/logos/logo.png');
}
}
} else {
$('.logo img').attr('src', 'img/logos/logo.png');
}
}
function doSticky()
{
if ($(document).scrollTop() > 40) {
$('.do-sticky').addClass('sticky-header');
//$('.do-sticky').addClass('header-shrink');
}
else {
$('.do-sticky').removeClass('sticky-header');
//$('.do-sticky').removeClass('header-shrink');
}
}
function placedDashboard() {
var headerHeight = parseInt($('.main-header').height(), 10);
$('.dashboard').css('top', headerHeight);
}
if($(document).find('#boxgallery').length > 0) {
new BoxesFx( document.getElementById( 'boxgallery' ) );
}
// Header shrink while page scroll
// Modal activation
$(document).on('click', '.property-video', function () {
$('#propertyModal').modal('show');
})
resizeModalsContent();
function resizeModalsContent() {
var winWidth = $(window).width();
var videoWidth = 450;
if(winWidth < 992 && winWidth > 767) {
videoWidth = 600;
} else if(winWidth <= 768) {
videoWidth = winWidth - 20;
}
var ratio = .6666;
var videoHeight = videoWidth * ratio;
$('.modalIframe').css('height', videoHeight);
}
function toggleChevron(e) {
$(e.target)
.prev('.panel-heading')
.find(".fa")
.toggleClass('fa-minus fa-plus');
}
$('.panel-group').on('shown.bs.collapse', toggleChevron);
$('.panel-group').on('hidden.bs.collapse', toggleChevron);
// Switching Color schema
$('.color-plate').on('click', function () {
var name = $(this).attr('data-color');
$('link[id="style_sheet"]').attr('href', '/css/skins/' + name + '.css');
if (name == 'default') {
$('.logo img').attr('src', 'img/logos/logo.png');
}
else {
$('.logo img').attr('src', '/img/logos/' + name + '-logo.png');
}
});
$('.setting-button').on('click', function () {
$('.option-panel').toggleClass('option-panel-collased');
});
$(window).resize(function () {
resizeModalsContent();
});
});
// mCustomScrollbar initialization
(function ($) {
$(window).resize(function () {
$('#map').css('height', $(this).height() - 110);
if ($(this).width() > 768) {
$(".map-content-sidebar").mCustomScrollbar(
{theme: "minimal-dark"}
);
$('.map-content-sidebar').css('height', $(this).height() - 110);
} else {
$('.map-content-sidebar').mCustomScrollbar("destroy"); //destroy scrollbar
$('.map-content-sidebar').css('height', '100%');
}
}).trigger("resize");
})(jQuery);