custom-jewelry-gallery

    Carica di più

    // ' } $(".productul").append(html); $("#show-area ul").append(html); ProductPop(); $(".load_more").attr("pageIndex",page); $(".load_more").attr("pageIndex",page); if (resultlook.length < 16 && page >= 2) { $(".load_more").hide(); return false; }; }, complete: function () { $(".load_more").removeClass("loading"); } }); } // 点击加载更多 $(".load_more").on("click",function(){ var index = $(".load_more").attr("pageIndex"); index++; console.log(index); Getproduct(index); $(".overlay").hide(); }); // 滚动加载更多 $(window).on("scroll", function () { var itemsTop = $(".product_list").offset().top; var itemsH = $(".product_list").height(); var windowTop = $(window).scrollTop(); var windowH = $(this).height(); if (itemsTop + itemsH - windowTop - windowH < 100 && !$(".load_more").hasClass('loading')) { var index = $(".load_more").attr('pageIndex'); index++; console.log(index) Getproduct(index); } }) // 产品弹窗轮播图 function ProductPop() { $(".product_list ul li").on("click", function () { var _index = $(this).index(); $(".fancybox_bg").addClass("bg_show"); document.documentElement.style.overflow = "hidden"; lunboPop(_index) Change(_index) HideProd() }) } // 关闭轮播图弹窗 function HideProd() { $(".fancybox_bg").on("click", function (event) { var offClose = $(".lunbo"); if (!offClose.is(event.target) && offClose.has(event.target).length === 0) { $(".fancybox_bg").removeClass("bg_show"); document.documentElement.style.overflow = "auto"; } }) } function lunboPop(currentIndex) { var imgtotal = $("#show-area ul li").length; var autoPlayIndex = 0; var imgwidth = $("#show-area ul li").width();//获取第一个li的长度用作动画切换效果 var showUl = imgtotal * imgwidth; $("#show-area ul").css("width", showUl); //通过循环更具图片数量自动添加控制按钮方便以后后台上传图片所用 for (var i = 0; i < imgtotal; i++) { $("#controler").append("
    " + "

    "); }; $("#controler div").eq(0).addClass("onclick"); $("#controler div").each(function () { $(this).click(function () { autoPlayIndex = $(this).index();//为模拟点击索引值赋值 Change(this); }); }); $(".nex_nav").click(function () { currentIndex++; if (currentIndex > imgtotal - 1) { currentIndex = imgtotal - 1; } Change(currentIndex) }) $(".pre_nav").click(function () { currentIndex--; if (currentIndex ' + 'Custom-Jewelry-Gallery' + ''; $('#show-area').append(loadingHTML); } function LoadShow() { // 第一个请求发送时展示loading $(document).on('ajaxStart', function () { $('.overlay').show(); }); } function LoadHide() { // 最后一个请求结束时隐藏loading $(document).on('ajaxStop', function () { $('.overlay').hide(); }); } $(".start_consul").on("click", function () { $(".modal_bg").addClass("bg_show"); document.documentElement.style.overflow = "hidden"; }) $(".modal_bg").on("click", function (event) { var offmodal = $(".modal_t"); if (!offmodal.is(event.target) && offmodal.has(event.target).length === 0) { $(".modal_bg").removeClass("bg_show"); document.documentElement.style.overflow = "auto"; } }) $(".close_pop").on("click", function (event) { $(".modal_bg").removeClass("bg_show"); document.documentElement.style.overflow = "auto"; }) // 图片上传预览 var form = new FormData();//通过HTML表单创建FormData对象 var url = '127.0.0.1:8080/' $('.filechnage').change(function () { var result = $(this).closest(".thumb-preview-uploaded").find(".inline")[0]; var files = this.files; if (files.length == 0) { return; } var file = files[0]; //把上传的图片显示出来 var reader = new FileReader(); // 将文件以Data URL形式进行读入页面 // console.log(reader); reader.readAsBinaryString(file); reader.onload = function (f) { var src = "data:" + file.type + ";base64," + window.btoa(this.result); result.innerHTML = ''; } form.append('file', file); }); // 获取select属性 $.ajax({ type: "post", dataType: "json", url: "https://custom.aporro.com/web/Home/AporroApi/advanced_custom_attribute", cache: false, success: function (data) { $(".make_style").text(data.msg.attr_4.desc); var obj = data.msg; var values =[]; for(var key in obj){ // keys.push(key); values.push(obj[key]);//取得value // console.log(values) } var select = ''; $(".form_make").html(select); $('.mySelect').find('option').eq(0).attr("selected","selected") var p1 = $(".mySelect").children('option:selected').val(); $("#check_vid").val(p1); $('.mySelect').change(function(){ p1=$(this).children('option:selected').val();//这就是selected的值 $("#check_vid").val(p1); }); } }) // form表单提交 $(".btn_submit").off('click').on("click", function (){ var formData = new FormData($( "#form_data" )[0]); $.ajax({ type: "post", dataType: "json", url: "https://custom.aporro.com/web/Home/AporroApi/advanced_custom", data: formData, // async: false, cache: false, contentType: false, processData: false, beforeSend(){ var userEmail = $(".validate-email").val(); var phone = $(".validate-phoneStrict").val(); var nama = $(".name_on").val(); var content = $(".textarea_content").val(); // // 验证用户名输入是否合法:非空 不能包含特殊字符 var reg = /^([a-zA-Z0-9_-])+@/; var reg1 = /^[0-9]+$/; if (userEmail == "" ||phone == "" ||nama==""||content=="") { return false; } }, success: function (data) { if(data.bool=="success"){ $("#form_data")[0].reset(); $(".btn-toolb p").html(data.va_title) .fadeIn(1000) .delay(10000) .fadeOut(3000); $("html").css("overflow","auto"); $("body").css("overflow","auto"); }else{ $(".btn-toolb p") .html(data.va_title) .fadeIn(1000) .delay(9000) .fadeOut(3000); setTimeout(() => { $(„.modal_bg“).removeClass(„bg_show“); $(„html“).css(„overflow“,“auto“); $(„body“).css(„overflow“,“auto“); }, 3000); } } }) }) $.ajax({ type: „post“, dataType: „json“, url: „https://custom.aporro.com/web/Home/AporroApi/country_option“, cache: false, success: function (data) { // console.log(data.msg); $(„.form_country select“).html(data.msg); $(„.form_country select“).val(„226“); }, }) }) // ]]>