', ''], }).on('changed.owl.carousel', syncPosition); sync2 .on('initialized.owl.carousel', function() { sync2.find(".owl-item").eq(0).addClass("current"); }) .owlCarousel({ items: slidesPerPage, dots: false, nav: false, smartSpeed: 200, slideSpeed: 500, autoHeight:true, margin: 10, slideBy: slidesPerPage, responsiveRefreshRate: 100 }).on('changed.owl.carousel', syncPosition2); function syncPosition(el) { var count = el.item.count - 1; var current = Math.round(el.item.index - (el.item.count / 2) - .5); if (current < 0) { current = count; } if (current > count) { current = 0; } 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(); sync1.data('owl.carousel').to(number, 300, true); });});$(document).ready(function() { $('body').on('click','.cmtl', function(e) { e.preventDefault(); $(this).addClass('cmtl_xanh'); }); $('body').on('click','.show-more', function(e){ e.preventDefault(); $('.article').css('height','auto'); $(this).remove(); });});$(document).ready(function () { $('.btnRatingUpload').bind('click', function () { $this = $(this); $this.parents('.formkh').find('.hdFileRatingUpload').click(); }); $('.hdFileRatingUpload').change(function (e) { e.preventDefault(); $this = $(this); var id = $(this).attr('id'); var error_images = ''; var form_data = new FormData(); var files = $('#' + id)[0].files; if (files.length > 100) { error_images += 'Bạn không thể chọn nhiều hơn 100 ảnh'; } else { for (var i = 0; i < files.length; i++) { var name = document.getElementById(id).files[i].name; var ext = name.split('.').pop().toLowerCase(); if (jQuery.inArray(ext, ['gif', 'png', 'jpg', 'jpeg']) == -1) { error_images += '
Invalid ' + i + ' File
'; } var oFReader = new FileReader(); oFReader.readAsDataURL(document.getElementById(id).files[i]); var f = document.getElementById(id).files[i]; var fsize = f.size || f.fileSize; if (fsize > 10000000) { error_images += 'Bạn chỉ có thể up ảnh dưới 10Mb
'; alert(error_images); } else { form_data.append('file[]', document.getElementById(id).files[i]); } } } form_data.append("action", "upload_star_product"); form_data.append("_token", "G6eg6s9Pr1VBg0nrvduwGOvywbbYHhAN2BoQcBYB"); if (error_images == '') { $.ajax({ url: 'https://chuyengiaocongnghe.vn/AjaxEnt', method: 'POST', data: form_data, contentType: false, cache: false, processData: false, beforeSend: function () { $('#error_multiple_files').html(); }, success: function (data) { $('#error_multiple_files').html(); $this.parents('.formkh').find('.resImg_hdFileRatingUpload').prepend(data); $this.parents('.formkh').find('.hdFileRatingUpload').val(''); return false; } }); } else { $this.parents('.formkh').find('.hdFileRatingUpload').val(''); $this.parents('.formkh').find('.error_multiple_files').html(); return false; } }); $.fn.extend({ toggleText: function (a, b) { var isClicked = false; var that = this; this.click(function () { if (isClicked) { that.text(a); isClicked = false; } else { that.text(b); isClicked = true; } }); return this; } }); $('body').on('click','.delete_img_upload_cmt', function(e) { e.preventDefault(); var id = $(this).attr('id'); $('.data_edit_'+id).remove(); }); $('body').on('click', '#guidanhgia', function(e){ e.preventDefault(); $this = $(this); var stardata = $("#formstar").serialize(); $.ajax({ url: 'https://chuyengiaocongnghe.vn/AjaxEnt', type : 'POST', data : { stardata : stardata, _token : "G6eg6s9Pr1VBg0nrvduwGOvywbbYHhAN2BoQcBYB", action : 'data_star_product' }, success : function(data) { $this.parents('.formkh').find('.ratingLst').prepend(data); $this.parents('.formkh').find('.if .alert').css('display', 'block'); $this.parents('.formkh').find('.if .alert').text('Gửi đánh giá thành công'); $this.parents('.formkh').find('#fRContent').val(''); $this.parents('.formkh').find('#fRPhone').val(''); $this.parents('.formkh').find('#fRName').val(''); $this.parents('.formkh').find('#fREmail').val(''); $this.parents('.formkh').find('.hdFileRatingUpload').val(''); $this.parents('.formkh').find('.resImg_hdFileRatingUpload').html(''); } }); }); $(".click_show_cmt").toggleText('Gửi đánh giá của bạn', 'Đóng lại'); $('.click_show_cmt').on('click', function (e) { e.preventDefault(); $('.toprt form').toggle(); $('.ips').toggle(); $('.click_show_cmt').toggleClass('close-btt'); }); $('#s1').on('click', function () { $('#s1').removeClass('iconcom-unstar'); $('#s1').addClass('iconcom-star'); $('#s2').removeClass('iconcom-star'); $('#s3').removeClass('iconcom-star'); $('#s4').removeClass('iconcom-star'); $('#s5').removeClass('iconcom-star'); $('#s2').addClass('iconcom-unstar'); $('#s3').addClass('iconcom-unstar'); $('#s4').addClass('iconcom-unstar'); $('#s5').addClass('iconcom-unstar'); var content = 'Không thích'; $('.rsStar').html(content); $('.rsStar').css('display', 'inline-block'); }); $('#s2').on('click', function () { $('#s1').removeClass('iconcom-unstar'); $('#s2').removeClass('iconcom-unstar'); $('#s1').addClass('iconcom-star'); $('#s2').addClass('iconcom-star'); $('#s3').removeClass('iconcom-star'); $('#s4').removeClass('iconcom-star'); $('#s5').removeClass('iconcom-star'); $('#s3').addClass('iconcom-unstar'); $('#s4').addClass('iconcom-unstar'); $('#s5').addClass('iconcom-unstar'); var content = 'Tạm được'; $('.rsStar').html(content); $('.rsStar').css('display', 'inline-block'); }); $('#s3').on('click', function () { $('#s1').removeClass('iconcom-unstar'); $('#s2').removeClass('iconcom-unstar'); $('#s3').removeClass('iconcom-unstar'); $('#s1').addClass('iconcom-star'); $('#s2').addClass('iconcom-star'); $('#s3').addClass('iconcom-star'); $('#s4').removeClass('iconcom-star'); $('#s5').removeClass('iconcom-star'); $('#s4').addClass('iconcom-unstar'); $('#s5').addClass('iconcom-unstar'); var content = 'Bình thường'; $('.rsStar').html(content); $('.rsStar').css('display', 'inline-block'); }); $('#s4').on('click', function () { $('#s1').removeClass('iconcom-unstar'); $('#s2').removeClass('iconcom-unstar'); $('#s3').removeClass('iconcom-unstar'); $('#s4').removeClass('iconcom-unstar'); $('#s1').addClass('iconcom-star'); $('#s2').addClass('iconcom-star'); $('#s3').addClass('iconcom-star'); $('#s4').addClass('iconcom-star'); $('#s5').removeClass('iconcom-star'); $('#s5').addClass('iconcom-unstar'); var content = 'Rất tốt'; $('.rsStar').html(content); $('.rsStar').css('display', 'inline-block'); }); $('#s5').on('click', function () { $('#s1').removeClass('iconcom-unstar'); $('#s2').removeClass('iconcom-unstar'); $('#s3').removeClass('iconcom-unstar'); $('#s4').removeClass('iconcom-unstar'); $('#s5').removeClass('iconcom-unstar'); $('#s1').addClass('iconcom-star'); $('#s2').addClass('iconcom-star'); $('#s3').addClass('iconcom-star'); $('#s4').addClass('iconcom-star'); $('#s5').addClass('iconcom-star'); var content = 'Tuyệt vời quá'; $('.rsStar').html(content); $('.rsStar').css('display', 'inline-block'); }); $('.lStar > i').on('click', function () { $('.ipt').css('display', 'block'); var id = $(this).attr('id').replace(/[^0-9]/gi, ''); var id_int = parseInt(id, 10); $('#hdfStar').val(id_int); }); $("#fRContent").keyup(function () { $(".ckt").text(($(this).val().length) + " kí tự (tối thiểu 80 kí tự)"); }); $('.cmtr').on('click', function(e){ e.preventDefault(); var id = $(this).attr('id'); $('.rr-'+id).css('display','block'); }); $('body').on('click', '.rrSend_reaply', function (e) { e.preventDefault(); var id = $(this).attr('data-id'); var dataclass = $(this).attr('data-class'); $('.modal_cmtpost').show(); $(".cn_tt_cmtpost").attr("id", id); $(".cn_tt_cmtpost").attr("data-class", dataclass); }); $('body').on('click','.close_cmtpost', function(e) { $('.modal_cmtpost').hide(); }); $('body').on('click', '.cn_tt_cmtpost', function (e) { e.preventDefault(); var dataclass = $(this).attr('data-class'); var parent = $(this).attr('id'); var cfmUserName = $('.modal_cmtpost .cfmUserName').val(); var cfmUserPhone = $('.modal_cmtpost .cfmUserPhone').val(); var cfmUserEmail = $('.modal_cmtpost .cfmUserEmail').val(); var content = $('.reply_input' + parent + dataclass).val(); var hdfProductID = $('#hdfProductID').val(); if (parent == '' || cfmUserName == '' || cfmUserPhone == '' || content == '') { alert('Bạn phải điền đầy đủ thông tin') } else { $.ajax({ url: 'https://chuyengiaocongnghe.vn/AjaxEnt', type: 'POST', data: { _token : "G6eg6s9Pr1VBg0nrvduwGOvywbbYHhAN2BoQcBYB", dataclass: dataclass, parent: parent, cfmUserName: cfmUserName, cfmUserPhone: cfmUserPhone, cfmUserEmail: cfmUserEmail, hdfProductID: hdfProductID, content: content, action: 'reply_product' }, success: function (data) { $('.modal_cmtpost').hide(); $('#r-' + parent + dataclass).append(data); $('.cfmUserName').val(''); $('.cfmUserEmail').val(''); $('.reply_input' + parent + dataclass).val(''); $(".cn_tt").attr("id", ''); }, error: function () { $('#formstar .alert').removeClass('hidden'); $('#formstar .alert').html('Đã có lỗi xảy ra, hãy thử lại.'); } }); } }); $('body').on('click','.cmtl', function(e) { e.preventDefault(); var content = '1 thích'; $(this).html(content); }); $('.ent-section-header').click(function() { let $this = $(this); $this.toggleClass("closed active"); $this.siblings().slideToggle(); return false; });});jQuery(document).ready(function($) { $('body').on('click', '#p_commnet', function(e){ $this = $(this); $this.parents('.formkh').find('.if').css('display','block'); }); $("#p_commnet").keyup(function () { $(".p_ckt").text(($(this).val().length) + " kí tự (tối thiểu 80 kí tự)"); }); $('body').on('click', '#p_guidanhgia', function(e){ e.preventDefault(); var commentdata = $("#input_cmt").serialize(); var posttype = $(this).attr('data-posttype'); $.ajax({ url: 'https://chuyengiaocongnghe.vn/AjaxEnt', type : 'POST', data : { _token : "G6eg6s9Pr1VBg0nrvduwGOvywbbYHhAN2BoQcBYB", commentdata : commentdata, posttype : posttype, action : 'p_comment' }, success : function(data) { $this.parents('.formkh').find('.ratingLst').prepend(data); $this.parents('.formkh').find('.if .alert').css('display', 'block'); $this.parents('.formkh').find('.if .alert').text('Gửi đánh giá thành công'); $this.parents('.formkh').find('#p_commnet').val(''); $this.parents('.formkh').find('#p_name').val(''); $this.parents('.formkh').find('#p_mail').val(''); $this.parents('.formkh').find('.hdFileRatingUpload').val(''); $this.parents('.formkh').find('.resImg_hdFileRatingUpload').html(''); $this.parents('.formkh').find('.resImg').html(''); } }); }); $('body').on('click', '.tlcmtr', function(e){ e.preventDefault(); var id = $(this).attr('id'); $('.tlrr-'+id).css('display','block'); }); $('body').on('click', '.p_rrSend_reaply', function (e) { e.preventDefault(); var id = $(this).attr('data-id'); var dataclass = $(this).attr('data-class'); $('.modal_p_cmt').show(); $(".b_r_p_button").attr("id", id); $(".b_r_p_button").attr("data-class", dataclass); }); $('body').on('click','.p_close_cmtpost', function(e) { $('.modal_p_cmt').hide(); }); $('body').on('click', '.b_r_p_button', function (e) { e.preventDefault(); var dataclass = $(this).attr('data-class'); var parent = $(this).attr('id'); var r_p_name = $('.r_p_name').val(); var r_p_mail = $('.r_p_mail').val(); var content = $('.reply_input' + parent + dataclass).val(); var p_id = $('#p_id').val(); if (parent == '' || r_p_name == '' || r_p_mail == '' || content == '') { alert('Bạn phải điền đầy đủ thông tin') } else { $.ajax({ url: 'https://chuyengiaocongnghe.vn/AjaxEnt', type: 'POST', data: { _token : "G6eg6s9Pr1VBg0nrvduwGOvywbbYHhAN2BoQcBYB", dataclass: dataclass, parent: parent, name: r_p_name, phone: r_p_mail, p_id: p_id, content: content, action: 'cmt_product' }, success: function (data) { $('.modal_p_cmt').hide(); $('#r-' + parent + dataclass).append(data); $('.r_p_name').val(''); $('.r_p_mail').val(''); $('.reply_input' + parent + dataclass).val(''); $(".b_r_p_button").attr("id", ''); }, error: function () { $('#formstar .alert').removeClass('hidden'); $('#formstar .alert').html('Đã có lỗi xảy ra, hãy thử lại.'); } }); } }); $('body').on('click','.close_showimgdt', function(e) { $('.showimgdt').css('display','none'); $('html,body').css('overflow','auto'); }); $('body').on('click','.starimgsrc, .starimgsrc img, .starimgsrc .txt', function(e) { e.preventDefault(); var idproduct = $('.page-type-product').attr('data-id'); $this = $(this); $.ajax({ url: 'https://chuyengiaocongnghe.vn/AjaxEnt', type: 'POST', data: { _token : "G6eg6s9Pr1VBg0nrvduwGOvywbbYHhAN2BoQcBYB", idproduct: idproduct, action: 'load_star_img' }, success: function (data) { $('.contentshowimgdt').html(data); $('.showimgdt').css('display','block'); $('html,body').css('overflow','hidden'); sliderimgstar(); }, error: function () { } }); }); $('body').on('click','.play_icon', function(e){ e.preventDefault(); var id = $(this).attr('data-y'); var ifa = ''; $(this).parents('.slider-banner-image').html(ifa); });});