'; $('#paketSerbaOnSidebar').html(strHtml); $('#paketSerbaOnSidebar').modal(); $('img[name="imgSerbaInfo"]').each(function() { var imgUrl = $(this).attr('data-src'); //alert(imgUrl); $(this).attr('src', imgUrl).load(function() {}).error(function() { $(this).attr('src', ctx + '/assets/desktop/img/alfacart_default.png'); }); }); } function animate(persentase, subtotal, freeongkir){ var persen = 0; var ongkirText = "Free Ongkir min belanja Rp 50.000*"; if (persentase >= 100) { persen = 100; ongkirText = "Selamat, Anda mendapatkan Free Ongkir*"; } else if (persentase > 0 && persentase < 100) { var kurang = Number(freeongkir) - Number(subtotal); kurang = kurang.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1.") persen = persentase; ongkirText = "Kurang Rp " + kurang + " lagi untuk Free Ongkir*"; } $(".progress-bar").css('width', "0px"); setTimeout(function() { $(".progress-bar").animate({ width: persen + '%' }, "normal", function(){ if (persen == 100) { $('.sidebar-right-header p').html(ongkirText); //$('.sidebar-right-header').css("background-image","url(https://www.alfacart.com/assets/desktop/img/others/free_ongkir.gif)"); } else { $('.sidebar-right-header').removeAttr('style'); $('.sidebar-right-header p').html(ongkirText); } }); }, 300); } function addQty(qty){ $("#qtyproduct").val(qty); $("div [name='tierPrice']").removeClass("active"); $("#addQty" + qty).addClass("active"); } function readmore(){ $('#readlessDescription').css('max-height','1000%'); //$('#readlessDescription > div > div:first-child').addClass('remove'); //$('#readlessDescription > p:first-child').addClass('remove'); $('#readlessDescription').addClass('remove'); $("#readmore").attr("onclick","readless()"); $("#readmore").html("Lihat Sedikit "); } function readless(){ var offsets = $("#descProd").position(); var top = offsets.top; $('#readlessDescription').css('max-height','130px'); //$('#readlessDescription > div > div:first-child').removeClass('remove'); //$('#readlessDescription > p:first-child').removeClass('remove'); $('#readlessDescription').removeClass('remove'); $("#readmore").attr("onclick","readmore()"); $("#readmore").html("Lihat Semua "); $("html, body").scrollTop(top); } function isNumberKey(evt){ var charCode = (evt.which) ? evt.which : event.keyCode if (charCode > 31 && (charCode < 48 || charCode > 57)) return false; return true; } function renderSlider(pdpSlide1, pdpSlide2){ //alert("asd"); /* PDP Front Slider */ var sync1 = pdpSlide1; var sync2 = pdpSlide2; var slidesPerPage = 3; //globaly define number of elements per page var syncedSecondary = true; sync1.owlCarousel({ animateOut: 'fadeOut', items : 1, slideSpeed : 1000, nav: false, mouseDrag: false, touchDrag: false, lazyLoad:true, autoplay: false, dots: false, /*loop: $('.owl-carousel img').length > 3 ? true : false,*/ responsiveRefreshRate : 200, }).on('changed.owl.carousel', syncPosition); sync2 .on('initialized.owl.carousel', function () { sync2.find(".owl-item").eq(0).addClass("current"); }) .owlCarousel({ items : slidesPerPage, dots: false, mouseDrag: false, touchDrag: false, nav: true, lazyLoad:true, margin: 5, smartSpeed: 200, slideSpeed : 500, slideBy: slidesPerPage, //alternatively you can slide by 1, this way the active slide will stick to the first item in the second carousel responsiveRefreshRate : 100, navText: ['',''], }).on('changed.owl.carousel', syncPosition2); function syncPosition(el) { //if you set loop to false, you have to restore this next line //var current = el.item.index; //if you disable loop you have to comment this block // var count = el.item.index; // var current = Math.round(el.item.index - (el.item.count/2) - .5); // // if(current < 0) { //	current = count; // } // if(current > count) { //	current = 0; // } //end block var current = el.item.index; sync2 .find(".owl-item") .removeClass("current") .eq(current) .addClass("current"); var onscreen = sync2.find('.owl-item.active').length - 1; var start = sync2.find('.owl-item.active').first().index(); var end = sync2.find('.owl-item.active').last().index(); if (current > end) { sync2.data('owl.carousel').to(current, 100, true); } if (current < start) { sync2.data('owl.carousel').to(current - onscreen, 100, true); } } function syncPosition2(el) { if(syncedSecondary) { var number = el.item.index; sync1.data('owl.carousel').to(number, 100, true); } } sync2.on("click", ".owl-item", function(e){ e.preventDefault(); var number = $(this).index(); //console.log(number); sync1.data('owl.carousel').to(number, 300, true); }); /* End PDP Front Slider */ /* Custom Input Increment */ jQuery('