create(target, [coordinates, useMotion, callback, useAutoClearAsRollout] );
*parameters |
target // 팝업으로 생성할 타겟으로 id 네이밍이나 dotTree형식(aaa.bbb.ccc...)의 타겟지정, 혹은 element 자체를 던져줄수 있다.
(optional)-------------------
coordinates = null // optional 값으로 팝업이 표시될 좌표이다. coordinates 에 호출한 객체를 던져주면 해당 객체의 바운딩 좌표에 맞추어서 팝업이 나타나며 {x:200, y:200} 처럼 좌표값을 지정하면
해당좌표값(단,글로벌좌표임)에 팝업이 나타나며 coordinates 값이 지정되지 않으면 기본 마우스위치기준으로 팝업이 나타난다.
하지만 가장 많이 사용되는 방법은 바로 특정 타겟 객체를 지정하고 해당 타겟 객체에 대한 마진을 상대값으로 적용하는것으로 이것은 시각적으로 모양새에 대한 퀄리티를 높일때 매우 유용하다.
{target:객체, x:marginx, y:marginy} 로 지정하면 된다.
useMotion = null // 기본적으로 팝업이 나타날때 모션처리가 수행된다. useMotion = false 이면 모션처리를 수행하지 않는다.
callback:function = null // 각 팝업에 대한 mouse 클릭상태를 callback핸들러로 수신받을수 있다. (mouseover, mousedown, mouseup 을 type으로 전달한다.)
ex)
AshPopup.manager.create('mydiv', mybutton, false, function(type) {
if(type == 'mouseup') this.clear(); // 생성된 팝업메뉴에서 각메뉴들을 누르면 팝업을 사라지게 한다.
});
useAutoClearAsRollout = true // 롤아웃 시에 자동으로 생성된 팝업엘리먼트를 제거한다. 만약 자동제거를 원하지 않는다면 false 값을 지정하면된다.
* return
-생성된 clone element를 반환한다. (물론 AshPopup.manager.cloner 를 이용해도 된다.)
좀더 세부적인 제어를 원한다면 이 반환된 clone element를 직접제어 해서 위치변경이나 innerHTML변경등 세부작업이 추가적으로 가능하다.
clear() // Clear the cloner's popup that has created from the target element.
생성된 팝업 엘리먼트를 제거한다.
<style type='text/css'>
.EditorCommon {
color:#666666; font-family:Arial; font-size:12px; line-height:1.6; white-space:nowrap;
}
</style>
<script type="text/javascript" src='AshAPI.js'></script>
<script type="text/javascript">
</script>
</head>
<body>
<div style='display:none;' >
<div id='direction' class='EditorCommon' style='padding:20px; background-color:#ffffff; border:1px solid #000000;'>
<a href="javascript:editPanel.setToolbarDirection('n');">North</a><br>
<a href="javascript:editPanel.setToolbarDirection('e');">East</a><br>
<a href="javascript:editPanel.setToolbarDirection('s');">South</a><br>
<a href="javascript:editPanel.setToolbarDirection('w');">West</a><br>
</div>
<div id='FontList' class='EditorCommon' style=' padding:20px; background-color:#ffffff; border:1px solid #aaaaaa;'>
<a href="javascript:;">Arial</a><br>
<a href="javascript:;">돋움</a><br>
<a href="javascript:;">돋움체</a><br>
<a href="javascript:;">굴림</a><br>
<a href="javascript:;">굴림체</a><br>
<a href="javascript:;">궁서</a><br>
<a href="javascript:;">궁서체</a><br>
<a href="javascript:;">Tahoma</a><br>
<a href="javascript:;">Tims New Roman</a><br>
<a href="javascript:;">Courier New</a><br>
<a href="javascript:;">Verdana</a>
</div>
</div>
<! -- 마우스오버일때(기본) -->
<span onmouseover="AshPopup.manager.create('direction', this);" style='cursor:pointer;'>direction(기본) </span>
<! -- 마우스오버일때(등장모션 사용하지 않음) -->
<span onmouseover="AshPopup.manager.create('FontList', this, false);" style='cursor:pointer;'>Font Lists(등장모션 사용하지 않음)</span>
<! -- 마우스클릭할때(마우스롤아웃일때 자동으로 clear되지 않게 함) -->
<div style='position:absolute; left:100px; top:100px;'>
<span onclick="AshPopup.manager.create('direction', this, true, null, false);" style='cursor:pointer;'>direction(MouseRollout시 자동으로 clear되지 않게 함)</span>
</div>
<! -- 마우스오버일때(팝업영역이 document clientWidth 영역을 벗어나면 자동 위치보정/ 팝업내부에서 마우스업 시에 클리어하게 적용함) -->
<div style='float:right;'>
(팝업영역이 document clientWidth 영역을 벗어나면 자동 위치보정/ 팝업내부에서 마우스업 시에 클리어하게 적용함)
<span onmouseover="AshPopup.manager.create('FontList', this, true, function(type) {if(type=='mouseup') this.clear();});" style='cursor:pointer;'>Font Lists</span>
</div>
<! -- 마우스클릭할때(팝업 포지션을 현재 엘리먼트 위치가 아닌 마우스 좌표 위치로 자동으로 맞추게 설정) -->
<div style='position:absolute; left:150x; top:150px;'>
<span onclick="AshPopup.manager.create('direction');" style='cursor:pointer;'>direction(Mouse x/y 팝업 포지션을 현재 엘리먼트 위치가 아닌 마우스 좌표 위치로 자동으로 맞추게 설정)</span>
</div>
<! -- 마우스오버일때(팝업영역이 지정한 좌표영역에서 나타나게함) -->
<div style='position:absolute; left:200x; top:200px;'>
<span onmouseover="AshPopup.manager.create('FontList', {x:100, y:300});" style='cursor:pointer;'>Font Lists({x:100, y:300})</span>
</div>
</body>
All Articles



1
LINK • SUMMARY
