var winWidth,
winHeight;
function set_background() {
$('.set-bg').each(function() {
if (typeof $(this).attr('data-mob-img') === 'undefined') {
$(this).css({
'background': 'url(' + $(this).attr('data-img') + ')',
'background-size': 'cover'
});
} else {
if (winWidth > mobile_breakbpoint) {
if (typeof $(this).attr('data-img') != 'undefined') {
$(this).css({
'background': 'url(' + $(this).attr('data-img') + ')',
'background-size': 'cover'
});
}
} else {
$(this).css({
'background': 'url(' + $(this).attr('data-mob-img') + ')',
'background-size': 'cover'
});
}
}
});
}
function get_height_width() {
winWidth = $(window).width(),
winHeight = $(window).height();
}
function set_height_width() {
if ($('body').height() < winHeight) {
$('.wh').outerHeight(winHeight);
}
$('.wh-min').css('min-height', winHeight);
$('.ww').outerWidth(winWidth);
}
function menuActive() {
var m = $('.bs-header').attr('data-nav').toLowerCase();
$('.main-nav li a').each(function(index) {
if ($(this).html().toLowerCase() == m) {
$(this).addClass('active');
} else {
$(this).removeClass('active');
}
});
}
//slider
function announce_swiper(){
var swiper = new Swiper('.announce-swiper', {
slidesPerView: 1 ,
spaceBetween: 15,
// centeredSlides:true,
loop:true,
autoplay:{
delay:2000
},
breakpoints: {
640: {
slidesPerView: 1,
// spaceBetween: 20,
},
768: {
slidesPerView: 1,
// spaceBetween: 40,
},
1024: {
slidesPerView: 3,
// spaceBetween: 50,
},
},
pagination: {
el: '.swiper-pagination',
clickable: true,
},
});
}
$(function() {
get_height_width();
set_height_width();
set_background();
announce_swiper();
});
$(document).ready(function() {
$(window).bind('scroll', function () {
if ($(window).scrollTop() >100) {
$('.navbar').addClass('sticky');
} else {
$('.navbar').removeClass('sticky');
}
});
});
0 Comments