$(function(){ $('#property-last a').click(function() { $('#property-last a').removeClass('active'); $(this).addClass('active'); load_property($(this).data("id"),$(this).data("category"),$(this).data("limits")); }); init_zzim(); $(".property-zzim span").click(function(event){ event.stopPropagation(); event.preventDefault(); }); if($("#keyword").length > 0){ $("#keyword").autocomplete({ selectFirst: false, autoFill: false, autoFocus: true, focus: function(event,ui){ return false; }, delay: 0, scrollHeight:40, minLength:2, select: function(a,b){ $("#lat").val(b.item.lat); $("#lng").val(b.item.lng); $("#keyword").val(b.item.title); $("#dong_id").val(b.item.id); a.stopPropagation(); return false; }, source: function(request, response){ totalSearch(lat,lng, response); }, }).data("ui-autocomplete")._renderItem = autoCompleteRenderSearch; } }); function load_property(body_id, category, limits){ $.ajax({ url: "/home/property_last", type: "POST", data: { category : category, limits : limits, }, dataType: "html", success: function(data) { $("#body_"+body_id).html(data); init_zzim(); $(".property-zzim span").click(function(event){ event.stopPropagation(); event.preventDefault(); }); // Multiple Carousel document.querySelectorAll('.carousel-multiple').forEach(carousel => new Splide(carousel, { perPage: 1.3, rewind: true, type: "loop", gap: 16, padding: 16, arrows: false, pagination: false, }).mount()); } }); } function init_zzim(){ $(".property-zzim span").click(function(){ if(confirm("로그인하시겠습니까?")){ location.href="/member/signin"; } }); } function totalSearch(lat,lng, response){ //숫자일 경우에는 매물검색으로 인식해서 해당 매물번호로 이동되므로 아무 것도 하지 않는다. if($.isNumeric($("#search").val())){ return; } else { $.ajax({ url: "/search/address", type: "POST", data: { keyword : $("#keyword").val(), }, dataType: "json", success: function(data) { if(data!=""){ response( $.map( data, function( item ) { return { id: item.id, title: item.title, type: item.type, hosun: item.hosun, lat: item.lat, lng: item.lng }; })); } } }); } } function autoCompleteRenderSearch(ul, item) { return $("
  • ").data("item.autocomplete", item).append(' '+item.title).appendTo(ul); }