function main() {
(function () {
'use strict';
$('a.scroll-down').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top - 40
}, 900);
return false;
}
}
});
$(window).scroll(function() {
if ($(this).scrollTop() > 100) {
$('.scroll-up').fadeIn();
} else {
$('.scroll-up').fadeOut();
}
});
$(window).bind('scroll', function() {
// // show Menu
var navHeight = $(window).height() - 100;
if ($(window).scrollTop() > 0) {
$('.navbar-default').addClass('on');
} else {
$('.navbar-default').removeClass('on');
}
// show Logo
if ($(window).scrollTop() > 0) {
$('#navbar-nav-top').removeClass('navbar-nav-centered');
$('.navbar-brand').show();
} else {
$('#navbar-nav-top').addClass('navbar-nav-centered');
$('.navbar-brand').hide();
}
});
$('body').scrollspy({
target: '.navbar-default',
offset: 80
})
$(document).ready(function() {
/* Smooth scroll */
$('.scroll-up').on("click", function(e){
var anchor = $(this).find('a');
// $('html, body').stop().animate({ scrollTop: $(anchor.attr('href')).offset().top }, {duration: 1000, queue: false, step: $.noop});
$('html, body').animate({ scrollTop: 0 }, {duration: 1000, queue: false, step: $.noop});
e.preventDefault();
});
/* Smooth scroll */
$('.page-scroll').on("click", function(e){
var anchor = $(this).find('a');
$('html, body').animate({ scrollTop: $(anchor.attr('href')).offset().top - 30 }, {duration: 1000, queue: false, step: $.noop});
e.preventDefault();
});
/* Smooth scroll / Scroll To Top */
// $('.page-scroll').on("click", function(e){
// var anchor = $(this);
// $('html, body').stop().animate({
// scrollTop: $(anchor.attr('href')).offset().top
// }, 1000);
// e.preventDefault();
// });
$("#advertising").owlCarousel({
autoPlay: 4000,
navigation : false,
slideSpeed : 300,
paginationSpeed : 400,
singleItem: true,
responsive: true,
loop: true,
});
$("#media").owlCarousel({
responsive: true,
navigation : true, // Show next and prev buttons
navigationText: [
"",
""
],
slideSpeed : 300,
itemsScaleUp:true,
stopOnHover: true,
paginationSpeed : 400,
autoHeight : true,
lazyLoad: true,
loop: true,
itemsCustom : [
[0, 1],
[479, 1],
[620, 2],
[768, 3],
[979, 4],
[998, 4],
[1000, 4],
[1199, 5],
[1400, 6],
[1600, 6]
]
});
});
$(window).load(function() {
/* Home BG */
$(".screen-height").height($(window).height());
$(window).resize(function(){
$(".screen-height").height($(window).height());
});
});
}());
}
main();