| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- $(function(){
- // nav car search
- $("#nav .car_search, #nav .nav_list .guide").click(function(){
- if(!$(this).hasClass("on")){
- //$(this).addClass("on");
- $("#nav .car_search, #nav .nav_list .guide").addClass("on");
- $("#search_box_wrap").animate({"width":"340px"}, 500);
- } else {
- $("#search_box_wrap").animate({"width":"0"}, 500, function(){
- $("#nav .car_search, #nav .nav_list .guide").removeClass("on");
- });
- }
- return false;
- });
- $("#search_box .close").click(function(){
- $("#search_box_wrap").animate({"width":"0"}, 500, function(){
- $("#nav .car_search").removeClass("on");
- });
- return false;
- });
- $("#search_box ul > li > span").click(function(){
- if(!$(this).parent().hasClass("open")){
- $(this).parent().siblings("li").removeClass("open");
- $(this).parent().siblings("li").find("ul").hide();
- $(this).parent().addClass("open");
- $(this).parent().find("ul").show();
- } else {
- $(this).parent().removeClass("open");
- $(this).siblings("ul").hide();
- }
- });
- $("#search_box .option > li").click(function(){
- var _text = $(this).text();
- $(this).parent().siblings("span").text(_text);
- $(this).parent().hide();
- $(this).parents().parents().removeClass("open");
- if(!$(this).hasClass("select")){
- $(this).siblings().removeClass("select");
- $(this).addClass("select");
- }
- });
- // car search
- $(".search > ul > li > span").click(function(){
- if(!$(this).parent().hasClass("open")){
- $(this).parent().siblings("li").removeClass("open");
- $(this).parent().siblings("li").find("ul").hide();
- $(this).parent().addClass("open");
- $(this).parent().find("ul").show();
- } else {
- $(this).parent().removeClass("open");
- $(this).siblings("ul").hide();
- }
- });
- $(".search .option > li").click(function(){
- var _text = $(this).text();
- $(this).parent().siblings("span").text(_text);
- $(this).parent().hide();
- $(this).parents().parents().removeClass("open");
- if(!$(this).hasClass("select")){
- $(this).siblings().removeClass("select");
- $(this).addClass("select");
- }
- });
- $(document).mouseup(function(e) {
- var container = $(".search");
- var container_in = $(".search .option");
- if (!container.is(e.target) && container.has(e.target).length === 0){
- container_in.css("display","none");
- container.find("li").removeClass("open");
- }
- });
- // option
- $(".option_info > li > span").click(function(){
- if(!$(this).hasClass("on")){
- $(this).parents(".option_info").find("li > span").removeClass("on");
- $(this).parents(".option_info").find("li ul").hide();
- $(this).addClass("on");
- $(this).siblings().show();
- } else {
- $(this).removeClass("on");
- $(this).siblings().hide();
- }
- });
- // go to top
- $("#nav .btn_top").mouseover(function(){
- $(this).addClass("on");
- });
- $("#nav .btn_top").mouseleave(function(){
- $(this).removeClass("on");
- });
- $("#nav .btn_top a").click(function(){
- $("html,body").animate({scrollTop:"0"}, 300);
- return false;
- });
- // top visual
- var swiper = new Swiper('#visual', {
- slidesPerView: 1,
- loop: true,
- speed: 800,
- pagination: {
- el: '.swiper-pagination',
- clickable: true,
- },
- autoplay: {
- delay: 3000,
- disableOnInteraction: false,
- },
- });
- // photo
- $(".car_photo li, .showroom_photo li").click(function(){
- //var _place = $(".car_photo .placeholder").find("img");
- var _place = $(this).parent().parent().siblings(".placeholder");
- var _img = _place.find("img");
- var _src = $(this).find("img").attr("src");
- _img.attr("src", _src);
- });
- // tab
- $(".tab_blue li").click(function(){
- var _idx = $(this).index();
- $(".tab_cont").hide().eq(_idx).show();
- if(!$(this).hasClass("on")){
- $(this).parent().find("li").removeClass("on");
- $(this).addClass("on");
- }
- return false;
- });
- Resize();
- $( window ).resize(function() {
- Resize();
- });
-
- });
- // layer popup
- function viewPopup(obj){
- $("." + obj + "_popup").show();
- $("body").append("<div class='dim'></div>");
- }
- function closePopup(obj){
- $("." + obj + "_popup").hide();
- $(".dim").remove();
- }
- // banner
- function Resize(){
- var w = $("body").width();
- if(w > 1900){
- $("#left_banner").addClass("wide");
- } else {
- $("#left_banner").removeClass("wide");
- }
- $(window).scroll(function(){
- var scrollTop = $(window).scrollTop();
- if(scrollTop > 540){
- $("#left_banner").css({"position":"fixed","top":"20px"});
- } else {
- $("#left_banner").css({"position":"absolute","top":"560px"});
- }
- }).scroll();
- /*var iScrollPos = 0;
- $(window).scroll(function() {
- var iCurScrollPos = $(this).scrollTop();
- var scrollTop = $(window).scrollTop();
- var newPosition = scrollTop + 560;
- var bannerOffset = $("#left_banner").offset();
- var bannerH = $("#left_banner").height();
- if (iCurScrollPos > iScrollPos && bannerOffset.top + bannerH >= $(document).outerHeight() - 370) {
- $("#left_banner").css({"top":bannerOffset.top + "px"});
- } else if(iCurScrollPos < iScrollPos && newPosition == $(document).height() - bannerOffset.top) {
- $("#left_banner").css({"top":newPosition + "px"});
- } else {
- $("#left_banner").css({"top":newPosition + "px"});
- }
- iScrollPos = iCurScrollPos;
- }).scroll();*/
- }
|