$(function () {
// navbar scolled background
$(window).scroll(function () {
var scroll = $(window).scrollTop();
if (scroll > 150) {
$("#navbar").removeClass("navbar-transparent");
$("#navbar").addClass("navbar-light bg-light");
} else {
$("#navbar").removeClass("navbar-light bg-light");
$("#navbar").addClass("navbar-transparent");
}
});
// Floating back to top
$('#back-to-top, .calculator, .whatsapp').hide();
$(window).scroll(function () {
if ($(this).scrollTop() > 450) {
$('#back-to-top, .calculator, .whatsapp').fadeIn();
} else {
$('#back-to-top, .calculator, .whatsapp').fadeOut();
}
});
// scroll body to 0px on click
$('#back-to-top').click(function () {
$('body,html').animate({
scrollTop: 0
}, 400);
return false;
});
$('.foto-produk').owlCarousel({
stagePadding: 50,
loop: true,
margin: 10,
nav: false,
dots: false,
autoplay: true,
autoplayTimeout: 3000,
autoplayHoverPause: true,
responsive: {
0: {
items: 1
},
600: {
items: 3
},
1000: {
items: 5
}
}
})
// Owl Carousel
$('.alur-carousel, .proses-carousel').owlCarousel({
stagePadding: 50,
loop: false,
margin: 30,
nav: false,
dots: true,
responsive: {
0: {
items: 1
},
600: {
items: 2
},
1000: {
items: 5
}
}
});
$('.testimonial-carousel, .story-carousel').owlCarousel({
loop: true,
margin: 10,
nav: false,
dots: true,
// autoplay: false,
// autoplayTimeout: 5000,
// autoplayHoverPause: false,
responsive: {
0: {
items: 1
},
600: {
items: 1
},
1000: {
items: 1
}
}
});
$('.brand').owlCarousel({
loop: true,
margin: 10,
nav: false,
dots: false,
responsive: {
0: {
items: 2
},
600: {
items: 3
},
1000: {
items: 8
}
}
});
$('.foto-carousel').owlCarousel({
loop: false,
margin: 10,
nav: true,
dots: false,
responsive: {
0: {
items: 2
},
600: {
items: 3
},
1000: {
items: 4
}
}
});
// if ($(window).width() <= 500) {
// $('#navbar').removeClass('navbar-transparent');
// $('#navbar').addClass('navbar-light bg-light');
// }
$(".navbar-toggler").click(function () {
// $("#navbar").removeClass("navbar-transparent");
$("#navbar").addClass("navbar-light bg-light");
})
/* -------------------- Bootstrap Custom File Input Label ------------------- */
$(".custom-file-input").on("change", function () {
let fileName = $(this).val().split("\\").pop();
let label = $(this).siblings(".custom-file-label");
if (label.data("default-title") === undefined) {
label.data("default-title", label.html());
}
if (fileName === "") {
label.removeClass("selected").html(label.data("default-title"));
} else {
label.addClass("selected").html(fileName);
}
});
})
//custom mrthod
function getImgSrc(str) {
if (str != null && str != '')
var urlImg = str.includes('https') ? str : fs_host + 'gets/images/' + str;
else
var urlImg = AWS_ASSET_URL + 'img/noimagefound.jpg';
return urlImg;
}
function generateHtmlStar(int) {
let html = ""
for (let i = 1; i <= 5; i++) {
if(i <= int) html += ''
else if ((i - int) < 1) html += ''
else html += ''
}
return html
}