모바일용 HTML 5의 특정 영역에 링크가 있는 이미지 (Image with links in certain areas in HTML 5 for mobile)


문제 설명

모바일용 HTML 5의 특정 영역에 링크가 있는 이미지 (Image with links in certain areas in HTML 5 for mobile)

Image of the app

저는 ionic으로 모바일 앱을 개발 중이며 인덱스 페이지에서 링크와 같이 이미지 영역을 클릭 가능하게 만들고 싶습니다. . 어떻게 할 수 있습니까? Javascript에서 그렇게하는 방법이 있습니까? 아니면 클릭 가능한 영역을 정의하는 도구입니까?


참조 솔루션

방법 1:

see: http://www.w3schools.com/tags/att_area_coords.asp

<img src="planets.gif" width="145" height="126" alt="Planets" usemap="#planetmap">

<map name="planetmap">
  <area shape="rect" coords="0,0,82,126" alt="Sun" href="sun.htm">
  <area shape="circle" coords="90,58,3" alt="Mercury" href="mercur.htm">
  <area shape="circle" coords="124,58,8" alt="Venus" href="venus.htm">
</map>

방법 2:

You are looking for an image map, which is what <map> is for. In your case you would add <area shape="circle" coords="x,y,r"... /> for your circles, where x,y are the x and y coordinates and r is the radius. There are even tools to define your own image map for example.

Note that to connect the <map> with your <img> by using usemap="#myImageMap" where myImageMap is the name on your map:

<img src="myImage.png" .. usemap="#myImageMap">
<map name="myImageMap">
    <area shape="circle" ... />
    ...
</map>

방법 3:

HTML tag map is designed exactly for this. Use href="javascript:onClick()" for JS calls instead of navigation.

<img src="planets.gif" width="145" height="126" alt="Planets" usemap="#planetmap">
<map name="planetmap">
    <area shape="rect" coords="0,0,82,126" href="sun.htm" alt="Sun">
    <area shape="circle" coords="90,58,3" href="mercur.htm" alt="Mercury">
    <area shape="circle" coords="124,58,8" href="venus.htm" alt="Venus">
</map>

MDN has a good specification of the area tag ‑ https://developer.mozilla.org/en‑US/docs/Web/HTML/Element/area

방법 4:

You can use <map> and <area>. But It can be not working on some devices and browsers. Then you can solve that problem through jQuery image map alternative

(by JimmynloomansSpencer Wieczorekap3rusWebEngine)

참조 문서

  1. Image with links in certain areas in HTML 5 for mobile (CC BY‑SA 2.5/3.0/4.0)

#regions #ionic #image #javascript






관련 질문

Resharper를 피하여 선언에 따라 영역을 추가하세요. (Avoid Resharper to add a region per Declaration)

모바일용 HTML 5의 특정 영역에 링크가 있는 이미지 (Image with links in certain areas in HTML 5 for mobile)

새로운 영역 생성 - Drupal 7에서 기쁨이 없음 (Creating New Region - No Joy in Drupal 7)

코드 영역을 접도록 Atom을 구성하는 방법 예: Sublime Text와 같은 ## region_name (How to configure Atom to fold code regions e.g. ## region_name like Sublime Text does)

선택 목록 apex 4.2를 기반으로 필드를 동적으로 추가 (Dynamically add fields based on select list apex 4.2)

HBase 클러스터에서 regionservers의 시작 코드를 얻는 방법은 무엇입니까? (How to get regionservers' startcode in a HBase cluster?)

코드에 자동으로 지역 추가 (Automatically add Regions to code)

Objective-C에서 startMonitoringForRegion을 사용하여 여러 지역을 스캔하는 방법 (How to scan multiple regions using startMonitoringForRegion in Objective-C)

HBase 테이블이 비어 있지만 영역이 증가합니다. (HBase table is empty, but regions are increased)







코멘트