var startx; var starty; var animated; function initcar() { $.ajax({ type: "get", url: "/webback/car/index", async: true, success: function(data) { jdata = data.data; var xianglingarr = { "versionid": "xiangling", "name": "绁ヨ彵", "attachment": "/webback/resources/attachment/xjsdn4fwduj5rzv3bkz85b", "typename": "鍗¤溅", "typeid": 55, "sort": 6, "createtime": 1507715748000 }; jdata.k0.push(xianglingarr); datafun(jdata); } }); } function clickfun() { $(".swiper-container").on("mousedown", function(e) {銆€銆€ animated = false;銆€銆€ e.preventdefault();銆€銆€銆€銆€ startx = e.clientx; starty = e.clienty; });銆€銆€ $(".car-content").on("click", ".swiper-slide", function() { var that = $(this); $(this).siblings(".swiper-slide").removeclass("swiper-slide-active"); $(this).siblings(".swiper-slide").find("a").attr('href', 'javascript:;'); $(this).addclass("swiper-slide-active"); var nowindex = parseint($(this).index() - 1); console.log(nowindex); $(this).parent(".swiper-wrapper").css({ "marginleft": -nowindex * 466 + "px" }); settimeout(function() { var hrefflag = $(that).find("a").attr("href1"); $(that).find("a").attr("href", hrefflag); }, 500) }); $(".car-typename-list li").on("click", function() { var typename_index = $(this).index(); $(".car-typename-list li").removeclass("carlist-active"); $(this).addclass("carlist-active"); $(".car-content .swiper-container").hide(); $(".car-content").find("#swiper" + typename_index).show(); }); $(".add-three-enter .common-div").mouseenter(function() { $(this).find(".threebox-content").css({ "padding-top": "250px", "background": "rgba(0,0,0,0.5)", "color": "#00c9ff" }); $(this).find("img").css({ "transform": "scale(1.05)", "-ms-transform": "scale(1.05)", "-moz-transform": "scale(1.05)", "-webkit-transform": "scale(1.05)", "-o - transform": "scale(1.05)" }); $(this).find(".chayue").css({ "border": "1px solid #00c9ff" }); }).mouseleave(function() { $(this).find(".threebox-content").css({ "padding-top": "66px", "background": "none", "color": "#fff" }); $(this).find(".chayue").css({ "border": "1px solid #fff" }); $(this).find("img").css({ "transform": "scale(1)", "-ms-transform": "scale()", "-moz-transform": "scale(1)", "-webkit-transform": "scale(1)", "-o - transform": "scale(1)" }); }); $(".news-box-list li").on("click", function() { var newsbox_index = $(this).index(); $(".news-box-list li").removeclass("carlist-active"); $(this).addclass("carlist-active"); $(".news-box-content .news-box-common").hide(); $(".news-box-content").find(".news-content-" + newsbox_index).show(); }); $(".common-fourbox").mouseenter(function() { $(this).find("dl").css({ "padding-top": "50px", "background": "rgba(0,0,0,0.2)", "color": "#00c9ff" }); $(this).find("img").css({ "transform": "scale(1.05)", "-ms-transform": "scale(1.05)", "-moz-transform": "scale(1.05)", "-webkit-transform": "scale(1.05)", "-o - transform": "scale(1.05)" }); }).mouseleave(function() { $(this).find("dl").css({ "padding-top": "160px", "background": "none", "color": "#fff" }); $(this).find("img").css({ "transform": "scale(1)", "-ms-transform": "scale()", "-moz-transform": "scale(1)", "-webkit-transform": "scale(1)", "-o - transform": "scale(1)" }); }); } function datafun(jdata) { for(var i = 0; i < $('.car-typename-list li').length; i++) { var str = "k" + i; var likey = jdata[str]; if(likey == undefined || likey == null) { var li = '
'; li += ''; li += '
'; // $(".car-content").append(li); continue; } var li = '
'; for(var j = 0; j < likey.length; j++) { li += '
' + '

' + likey[j].name + '

' + '' + likey[j].name + '' + '
'; } li += '
'; // $(".car-content").append(li); $("#swiper0 .swiper-wrapper").width(jdata.k0.length * 466 + "px"); if(i < 4) { $("#swiper" + i).find(".swiper-slide").eq(1).addclass("swiper-slide-active"); var hrefnum = $("#swiper" + i).find(".swiper-slide-active a").attr("href1"); $("#swiper" + i).find(".swiper-slide-active a").attr("href", hrefnum); } else if(i == 4) { $("#swiper" + i).find(".swiper-slide").eq(0).addclass("swiper-slide-active").css({ "marginleft": "466px" }); var hrefnum = $("#swiper" + i).find(".swiper-slide-active a").attr("href1"); $("#swiper" + i).find(".swiper-slide-active a").attr("href", hrefnum); } } } $(function() { clickfun(); initcar(); $(".news-content-0").find('.news-1-center').eq(0).show(); $(".news-content-1").find('.news-1-center').eq(0).show(); $(".news-content-2").find('.news-1-center').eq(0).show(); $(".news-content-3").find('.news-1-center').eq(0).show(); })