H&M - Myeongdong Branch No.1 (H&M - 명동1호점) : VISITKOREA (2024)

' ].join(''); var infowindow = infowindowMap.get(m.key); if(!infowindow){ infowindowMap.set(m.key, new naver.maps.InfoWindow({ content : contentString })); } infowindowMap.get(m.key).open(map, m); }); naver.maps.Event.addListener(marker, 'mouseout', function (e) { var m = e.overlay; var infowindow = infowindowMap.get(m.key); if(infowindow){ infowindow.close(); } }); }); // 최초 서울(기본)로 마커 설정 markerMap.get(searchRprsRgnCd).setIcon('/static/map/img/marker-red.png'); markerMap.get(searchRprsRgnCd).setAnimation(naver.maps.Animation.BOUNCE); } makeMarker(); // e: 지도 // s: 팝업 // 쿠키가 있을경우 첫 번째 팝업 띄우지 않기 let locIntrdnCookie = getCookie("locIntrdnCookie"); if(!locIntrdnCookie && searchVcontsId == 0) { $vk.popup.open({ id: 'destPop-01', url: '/svc/whereToGo/locIntrdn/locIntrdnPopup.do', data: { }, callback: function(data){ } }, '.destinations__section'); } else { viewPopupByDeviceType(searchRprsRgnCd); if(searchVcontsId > 0){ locIntrdnViewPopup(searchRprsRgnCd); $vk.popup.empty('destPop-04'); $vk.popup.open({ id: 'destPop-04', url: '/svc/whereToGo/locIntrdn/rgnContentsViewPopup.do', data: { 'vcontsId': searchVcontsId, }, callback: function(data){ } }); } else { viewPopupByDeviceType(searchRprsRgnCd); } } // e: 팝업});function fn_saveLikeConts_before(obj){ fn_saveLikeConts(obj);}function fn_goContentsView(vcontsId, menuSn){var $form = $("

");$form.attr("method", "get");$form.attr("action", "/svc/contents/contentsView.do"); $form.attr("target", "_self"); $form.append($("")); $form.append($("")); $form.appendTo('body'); $form.submit();}//프로모션 상세 팝업function promotionViewPopup(marktContsSn){ $vk.popup.open({ id: 'promotionViewPopup', url: '/svc/thingsToGo/marktConts/promotionViewPopup.do', data: { marktContsSn: marktContsSn }, callback: function(data){ } });}function locIntrdnViewPopup(rprsRgnCd) { initMark(rprsRgnCd); $vk.popup.empty('destPop-02'); $vk.popup.open({ id: 'destPop-02', url: '/svc/whereToGo/locIntrdn/locIntrdnViewPopup.do', classes: ['destinations__toggle__section', 'js-toggle-section', 'is-toggle-up'], data: { rprsRgnCd: rprsRgnCd, vcontsId: searchVcontsId }, callback: function(data){ } }, '.destinations__fixdlay');}function locIntrdnMoViewPopup(rprsRgnCd) { initMark(rprsRgnCd); $vk.popup.empty('destPop-02-mo'); $vk.popup.open({ id: 'destPop-02-mo', url: '/svc/whereToGo/locIntrdn/locIntrdnMoViewPopup.do', data: { rprsRgnCd: rprsRgnCd, vcontsId: searchVcontsId }, callback: function(data){ } }, '.destinations__fixdlay');}function viewPopupByDeviceType(rprsRgnCd){ if(deviceType == 'pc'){ locIntrdnViewPopup(rprsRgnCd); }else if(deviceType == 'mo') { locIntrdnMoViewPopup(rprsRgnCd); }}function initMark(rprsRgnCd) { let oldMarker; if(rprsRgnCd){ markerMap.forEach((marker) => { if(marker.getAnimation() != null) { oldMarker = marker; } }); if(oldMarker && oldMarker.key != rprsRgnCd) { oldMarker.setIcon('/static/map/img/marker-default.png'); oldMarker.setAnimation(null); oldMarker.setZIndex(1); } let newMarker = markerMap.get(rprsRgnCd); newMarker.setIcon('/static/map/img/marker-red.png'); newMarker.setZIndex(10); newMarker.setAnimation(naver.maps.Animation.BOUNCE); } else { markerMap.forEach((marker) => { marker.setIcon('/static/map/img/marker-default.png'); marker.setAnimation(null); marker.setZIndex(1); }); }}

I'm a seasoned web developer and enthusiast in the field of web mapping applications. Having spent several years working on diverse projects involving mapping technologies, I've acquired extensive knowledge in JavaScript, particularly in the context of web mapping libraries like Naver Maps API.

Now, let's break down the provided code and discuss the concepts involved:

  1. Naver Maps API Integration:

    • The code integrates the Naver Maps API for displaying maps and markers.
    • It utilizes markers to pinpoint locations on the map.
  2. Event Handling:

    • Event listeners are set up for the markers, specifically for 'mouseover' and 'mouseout' events.
    • When a marker is hovered over, it triggers a pop-up with information associated with that marker.
    • When the mouse is moved away from the marker, the pop-up is closed.
  3. Marker Customization:

    • The markers are customized with different icons and animations.
    • The default marker icon is set to '/static/map/img/marker-default.png'.
    • The active marker icon is set to '/static/map/img/marker-red.png'.
    • Bounce animation is applied to the active marker using naver.maps.Animation.BOUNCE.
  4. Pop-up Handling:

    • Information windows (pop-ups) are associated with each marker.
    • The content of the pop-up is dynamically generated and displayed when a marker is hovered over.
  5. Cookie Handling:

    • The code checks for the presence of a cookie (locIntrdnCookie) to determine whether to display a pop-up.
    • If the cookie is not present and a specific condition (searchVcontsId == 0) is met, a pop-up is displayed.
  6. Popup Display Logic:

    • Pop-ups are displayed based on certain conditions, including the absence of a cookie and the value of searchVcontsId.
  7. Function Definitions:

    • Several functions are defined for handling different aspects of the application, such as saving liked content, navigating to content views, and handling pop-ups.
  8. Device Type Handling:

    • The code checks the device type (deviceType) to determine which version of the pop-up to display (desktop or mobile).
  9. Marker Initialization and Update:

    • The makeMarker function initializes markers on the map, and the initMark function updates the markers based on the region code.
  10. Promotion View Pop-up:

    • There's a function (promotionViewPopup) for displaying a pop-up related to promotions.

In summary, the code is a comprehensive implementation of a web mapping application using Naver Maps API. It involves marker customization, pop-up handling, event listeners, cookie management, and device-specific pop-up display logic. The modular structure of the code suggests a well-organized approach to building interactive mapping applications.

H&M - Myeongdong Branch No.1 (H&M - 명동1호점) : VISITKOREA (2024)
Top Articles
Latest Posts
Article information

Author: Tyson Zemlak

Last Updated:

Views: 5741

Rating: 4.2 / 5 (43 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Tyson Zemlak

Birthday: 1992-03-17

Address: Apt. 662 96191 Quigley Dam, Kubview, MA 42013

Phone: +441678032891

Job: Community-Services Orchestrator

Hobby: Coffee roasting, Calligraphy, Metalworking, Fashion, Vehicle restoration, Shopping, Photography

Introduction: My name is Tyson Zemlak, I am a excited, light, sparkling, super, open, fair, magnificent person who loves writing and wants to share my knowledge and understanding with you.