웹마스터 팁
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
플래쉬 효과나는 신비 메뉴 - -? *수정+카피라이터~
2002.06.09 20:52
예제: http://my.netian.com/~qbqb0808/study51.htm
빨간색 점을 마우스로 클릭해보세요. 그리고 그 위로 퍼져나가는 메뉴들도 클릭해보세요.
정말 쥑이지 않나요? 소스가 길다는게 흠입니다만 하나다로 틀리면 실행이 전혀 안됩니다.
수정 부분을 잘보시고 수정해주세요.
**********************************************************************************
DotMenu
* Copyright (C) 2001 <a href="/dhtmlcentral/dan_pupius.asp">Dan Pupius</a>
* This script was released at DHTMLCentral.com
* Visit for more great scripts!
* This may be used and changed freely as long as this msg is intact!
* We will also appreciate any links you could give us.
*
* Made by <a href="/dhtmlcentral/dan_pupius.asp">Dan Pupius</a>
**********************************************************************************
<head> 와 </head> 사이에 입력하세요.
<style type="text/css">
.dot { position: absolute; width: 6; height: 6; visibility: hidden; background-color: red; font-size: 1px; cursor: pointer; cursor: hand; z-index: 100 }
.dotoff { position: absolute; width: 6; height: 6; visibility: hidden; background-color: gray; font-size: 1px; cursor:default; z-index: 100}
.dotempty { position: absolute; width: 6; height: 6; visibility: hidden; background-color: orange; font-size: 1px; cursor: pointer; cursor: hand; zindex: 100 }
.caption { position: absolute; visibility: hidden; font-family: Tahoma; color: black;
font-size: 11px; text-align: Center; cursor: default; z-index:
1 }
body { margin: 0px; background-color: white; }
a { color: silver; text-decoration: none }
p { font-size: 10px; font-family: tahoma; color: black }
</style>
<script language="JavaScript" type="text/javascript">
function lib_bwcheck(){ //Browsercheck (needed)
this.ver=navigator.appVersion
this.agent=navigator.userAgent
this.dom=document.getElementById?1:0
this.opera5=this.agent.indexOf("Opera 5")>-1
this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;
this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
this.ie=this.ie4||this.ie5||this.ie6
this.mac=this.agent.indexOf("Mac")>-1
this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
this.ns4=(document.layers && !this.dom)?1:0;
this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
return this
}
var bw=new lib_bwcheck()
// The code of this script is in the body, the browsercheck above is not used.
</script>
<body> 와 </body>사이에 추가해주세요.
<script language="javascript1.2" type="text/javascript">
<!--
// DotMenu
// provides cross-browser functionality
//======================================
function getObjectRef(name) {
if(document.getElementById) return document.getElementById(name);
else if(document.all) return document.all[name];
else return null;
}
// general functions to assist the script
//========================================
function show(name) {
var el = getObjectRef(name);
if(el) el.style.visibility = "visible";
}
function hide(name) {
var el = getObjectRef(name);
if(el) el.style.visibility = "hidden";
}
function getWidth(name) {
var el = getObjectRef(name);
return el.offsetWidth;
}
function getHeight(name) {
var el = getObjectRef(name);
return el.offsetHeight;
}
function moveMe(name,x,y) {
var el = getObjectRef(name);
if(el) { el.style.top = parseInt(y); el.style.left = parseInt(x); }
}
function moveBy(name,x,y) {
var el = getObjectRef(name);
if(el) { el.style.top = parseInt(el.style.top) + parseInt(y); el.style.left = parseInt(el.style.left) + parseInt(x); }
}
// Creates the menu objects
//==========================
var menuCount = 0;
function menuObject(name,x,y,caption, r, parent) {
if ( (!document.getElementById&&!document.all) || navigator.userAgent.indexOf("Opera")>-1) return;
document.write('<div id="divDot' + menuCount + '" class="dotempty" style="top: ' + y + '; left: ' + x + '"></div>');
document.write('<div id="divCap' + menuCount + '" class="caption" style="top: 0; left: 0">' + caption + '</div>');
this.name = name;
this.parent = parent
this.ref = "divDot" + menuCount;
this.caption = "divCap" + menuCount
if(r) this.radius = r;
else this.radius = 400;
this.subMenus = new Array();
this.state = 0;
this.moving = false;
if(this.parent) this.action = "null";
else this.action = "toggle";
if(this.parent) this.startAngle = parent.startAngle;
else this.startAngle = 0;
getObjectRef(this.ref).objRef = this.name;
this.show = function() { show(this.ref); }
this.hide = function() { hide(this.ref); }
this.moveMe = function(x,y) { if(this.parent) { x += this.parent.x(); y += this.parent.y(); } moveMe(this.ref,x,y); }
this.moveBy = function(x,y) { moveBy(this.ref,x,y); }
this.x = function() { return parseInt(getObjectRef(this.ref).style.left); }
this.y = function() { return parseInt(getObjectRef(this.ref).style.top); }
this.w = function() { return getWidth(this.ref); }
this.h = function() { return getHeight(this.ref); }
this.showCaption = function() {
moveMe(this.caption, this.x() - (getWidth(this.caption)/2) + (this.w()/2), (this.y() + this.h()));
show(this.caption);
}
this.hideCaption = function() {
hide(this.caption);
}
this.setCaption = function(c) { getObjectRef(this.caption).innerHTML = c;}
this.addItem = function(c,action,r) {
getObjectRef(this.ref).className = "dot";
if(!r) r = this.radius/2;
var sub = new menuObject(this.name + ".subMenus[" + this.subMenus.length + "]",0,0,c,r,this);
sub.parent = this;
sub.action = action;
sub.moveMe(0,0);
this.subMenus[this.subMenus.length] = sub;
return sub;
}
this.expand = function() {
if(this.subMenus.length > 0) {
var p = true;
if(this.parent) {
p = !this.parent.moving;
for(var i=0; i<this.parent.subMenus.length;i++)
p = p && ((this.parent.subMenus[i].state==0) || (this.parent.subMenus[i].state==this.parent.subMenus[i].subMenus.length)) && (this.parent.subMenus[i].moving==false);
} else var o = false;
if((!this.parent || this.parent.state == this.parent.subMenus.length) && p) {
if(this.parent) this.collapseAll(this.name);
var diff = 360 / this.subMenus.length;
for(var i=0;i<this.subMenus.length;i++){
this.subMenus[i].moveMe(0,0);
this.subMenus[i].show();
this.moving = true;
this.subMenus[i].slide(this.subMenus[i].radius * cos(degToRad((diff*i)+this.startAngle)), this.subMenus[i].radius * sin(degToRad((diff*i)+this.startAngle)), this.name + ".subMenus[" + i + "].showCaption();" + this.name + ".moving=false;" + this.name + ".state+=1;");
}
if(this.parent){
getObjectRef(this.parent.ref).style.filter = "alpha (opacity=33)";
getObjectRef(this.parent.ref).style.MozOpacity = "33%";
getObjectRef(this.parent.ref).className = "dotoff";
getObjectRef(this.parent.caption).style.filter = "alpha (opacity=33)";
getObjectRef(this.parent.caption).style.MozOpacity = "33%";
for(i=0;i<this.parent.subMenus.length;i++) {
getObjectRef(this.parent.subMenus[i].ref).style.filter = "alpha (opacity=66)";
getObjectRef(this.parent.subMenus[i].ref).style.MozOpacity = "66%";
getObjectRef(this.parent.subMenus[i].caption).style.filter = "alpha (opacity=66)";
getObjectRef(this.parent.subMenus[i].caption).style.MozOpacity = "66%";
}
if(this.parent.parent) {
for(i=0;i<this.parent.parent.subMenus.length;i++) {
getObjectRef(this.parent.parent.subMenus[i].ref).style.filter = "alpha (opacity=33)";
getObjectRef(this.parent.parent.subMenus[i].ref).style.MozOpacity = "33%";
getObjectRef(this.parent.parent.subMenus[i].ref).className = "dotoff";
getObjectRef(this.parent.parent.subMenus[i].caption).style.filter = "alpha (opacity=33)";
getObjectRef(this.parent.parent.subMenus[i].caption).style.MozOpacity = "33%";
}
getObjectRef(this.parent.parent.ref).style.MozOpacity = "33%";
getObjectRef(this.parent.parent.ref).style.MozOpacity = "33%";
getObjectRef(this.parent.parent.ref).className = "dotoff";
}
}
getObjectRef(this.ref).style.filter = "alpha (opacity=66)";
getObjectRef(this.caption).style.filter = "alpha (opacity=66)";
getObjectRef(this.ref).style.MozOpacity = "66%";
getObjectRef(this.caption).style.MozOpacity = "66%";
}
}
}
this.collapse = function() {
var p = true;
p = !this.moving;
for(var i=0; i<this.subMenus.length;i++)
p = p && (this.subMenus[i].state==0) && (this.subMenus[i].moving==false);
if(p && this.subMenus.length > 0) {
for(var i=0;i<this.subMenus.length;i++){
this.subMenus[i].hideCaption();
this.moving = true;
this.subMenus[i].slide(0, 0, this.name + ".subMenus[" + i + "].hide();" + this.name + ".moving=false;" + this.name + ".state-=1;");
}
if(this.parent){
getObjectRef(this.parent.ref).style.filter = "alpha (opacity=66)";
getObjectRef(this.parent.ref).style.MozOpacity = "66%";
if(this.parent.subMenus.length != 0)
getObjectRef(this.parent.ref).className = "dot";
else
getObjectRef(this.parent.ref).className = "dotempty";
getObjectRef(this.parent.caption).style.filter = "alpha (opacity=66)";
getObjectRef(this.parent.caption).style.MozOpacity = "66%";
for(i=0;i<this.parent.subMenus.length;i++) {
getObjectRef(this.parent.subMenus[i].ref).style.filter = "alpha (opacity=100)";
getObjectRef(this.parent.subMenus[i].ref).style.MozOpacity = "100%";
if(this.parent.subMenus[i].subMenus.length != 0)
getObjectRef(this.parent.subMenus[i].ref).className = "dot";
else
getObjectRef(this.parent.subMenus[i].ref).className = "dotempty";
getObjectRef(this.parent.subMenus[i].caption).style.filter = "alpha (opacity=100)";
getObjectRef(this.parent.subMenus[i].caption).style.MozOpacity = "100%";
}
if(this.parent.parent) {
for(i=0;i<this.parent.parent.subMenus.length;i++) {
getObjectRef(this.parent.parent.subMenus[i].ref).style.filter = "alpha (opacity=66)";
getObjectRef(this.parent.parent.subMenus[i].ref).style.MozOpacity = "66%";
if(this.parent.parent.subMenus[i].subMenus.length != 0)
getObjectRef(this.parent.parent.subMenus[i].ref).className = "dot";
else
getObjectRef(this.parent.parent.subMenus[i].ref).className = "dotempty";
getObjectRef(this.parent.parent.subMenus[i].caption).style.filter = "alpha (opacity=66)";
getObjectRef(this.parent.parent.subMenus[i].caption).style.MozOpacity = "66%";
}
}
}
getObjectRef(this.ref).style.filter = "alpha (opacity=100)";
getObjectRef(this.caption).style.filter = "alpha (opacity=100)";
getObjectRef(this.ref).style.MozOpacity = "100%";
getObjectRef(this.caption).style.MozOpacity = "100%";
}
}
this.collapseAll = function(except) {
for(var i=0;i<this.parent.subMenus.length;i++) {
if(this.parent.subMenus[i].name!=except && this.parent.subMenus[i].state==this.parent.subMenus[i].subMenus.length) {
this.parent.subMenus[i].collapse();
}
}
}
this.toggle = function(e) {
if(document.all) id = window.event.srcElement;
else id = e.target;
var dot = eval(id.objRef);
if(dot.state==0 && !dot.moving) dot.expand();
else if(dot.state==dot.subMenus.length && !dot.moving) dot.collapse()
}
this.doAction = function(e) {
if(document.all) id = window.event.srcElement;
else id = e.target;
var dot = eval(id.objRef);
if(dot.action == "toggle") dot.toggle(e);
else eval(dot.action);
}
//change these if you want to change the events that trigger the actions
//========================================================================
//getObjectRef(this.ref).onmousemove = this.toggle;
getObjectRef(this.ref).onmouseup = this.doAction;
this.slide = function(xx,yy,func) {
if(!func) func = "";
var px = this.parent.x();
var py = this.parent.y();
var x = xx - this.x() + px;
var y = yy - this.y() + py;
var d = sqrt(square(xx-this.x() + px) + square(yy-this.y() + py));
var v = d/8;
if(v<1) v = 1;
if( (Math.abs(x) < v) && (Math.abs(y) < v) ) {
moveMe(this.ref,xx + px,yy + py);
if(func != "") eval(func);
} else {
var a = round(atan(x,y));
dx = round(v * cos(degToRad(a)));
dy = round(v * sin(degToRad(a)));
this.moveBy(dx,dy);
setTimeout(this.name + ".slide(" + xx + "," + yy + ", '" + func + "');",10);
}
}
// Preoading the windows filters.
if (menuCount==0 && document.all) document.all[this.ref].style.filter = "alpha (opacity=100)";
menuCount++;
return this;
}
// Math functions
//================
var pi = Math.PI;
function square(x) { return (x*x); }
function sqrt(x) { return Math.sqrt(x); }
function round(x) { return Math.round(x); }
function rand(x,y) { return (round(Math.random()*(y-x)) + x); }
function cos(x) { return Math.cos(x) }
function sin(x) { return Math.sin(x) }
function degToRad(x) { return ( x/(360/(2*pi)) ); }
function radToDeg(x) { return ( x*(360/(2*pi)) ); }
function atan(s,t) {
if( s == 0.0 && t > 0.0)
angle = 90.0;
else if(s == 0.0 && t < 0.0)
angle = 270.0;
else if (s < 0.0 )
angle = 180.0 + radToDeg(Math.atan(t/s));
else if (s > 0.0 && t < 0.0)
angle = 360.0 + radToDeg(Math.atan(t/s));
else {
if(s==0.0) s=0.00001;
angle = radToDeg(Math.atan(t/s));
}
if(angle < 0.0) angle += 360.0;
return angle;
}
//====================================================================================
// make the menus and provide information on usage
//====================================================================================
//
// In order to customise your menus all you need to do is:
// - edit the styles .dot, .dotoff and .caption
// - add the main menu using the following code
// var [menu_name] = new menuObject("[menu_name]", [x position], [y position], [caption], [spacing between sub menus]);
// - add the subemus using:
// var [sub_menu] = [menu_name].addItem([caption],[action],[spacing]);
// OR
// var [sub-sub_menu] = [sub_menu].addItem([caption],[action],[spacing]);
// OR
// [menu_name].subMenus[x].addItem([caption],[action],[spacing]);
//
// - where action is string that get's evaluated when the dot is clicked
//
// (NOTE the spacing is optional and if left blank gets inherited
// and is equal to the (parent's value)/2 - the default for
// the main menu item uis 400)
//
// - the following allow extra manipulation of the menus:
// + menuItem.show() - show's the menu's dot
// + menuItem.showCaption() - show's the menu's caption
// + menuItem.hide()
// + menuItem.hideCaption()
// + menuItem.startAngle = x - default is 0-degrees which means the first submenu appears
// directly to the right, the following items are traced in a
// clockwise direction
// + menuItem.setCaption("text") - allows you to change a menus caption
// + menuItem.expand() - opens a menus submenus (if they exist)
// + menuItem.collapse() - closes a menu's subItems (unless one of them is open)
//
// + menuItem.moveMe(x,y) - moves a menu to coordinates (x,y)
// + menuItem.moveBy(x,y) - moves a menu by (x,y)-pixels
// + menuItem.x() & menuItem.y() - retrieve a menus coordinates
//
//====================================================================================
//get dimentions of the page
if(document.all) pageWidth = document.body.offsetWidth-20;
else pageWidth = innerWidth;
if(document.all) pageHeight = document.body.offsetHeight-4;
else pageHeight = innerHeight;
//Create main menu
var menu = new menuObject("menu",pageWidth/2,pageHeight/2,"Yoonmi.net",pageHeight/2);
menu.startAngle = -90;
//show menu and caption
menu.show();
menu.showCaption();
//Add submenus
menu.addItem("news","window.open('주소')");
menu.addItem("scripts","toggle");
menu.addItem("tutorials","toggle");
menu.addItem("forums","toggle");
menu.addItem("resources","toggle");
menu.subMenus[1].addItem("FoldOutMenu","window.open('/script/script22.asp')");
menu.subMenus[1].addItem("Loading Bar","window.open('/script/script17.asp')");
menu.subMenus[1].addItem("Window Script","window.open('/script/script16.asp')");
menu.subMenus[1].addItem("PageSlideFade","window.open('/script/script15.asp')");
menu.subMenus[1].addItem("Circle Menu","window.open('/script/script14.asp')");
menu.subMenus[1].addItem("Annimation Intro","window.open('/script/script9.asp')");
menu.subMenus[1].addItem("NewsSlideFade","window.open('/script/script10.asp')");
menu.subMenus[1].addItem("Other Scripts","window.open('/script/')");
menu.subMenus[2].addItem("Scripting for vs5 browsers","window.open('/tutorials/tutorial5.asp')");
menu.subMenus[2].addItem("Makeing a Dhtml Script","window.open('/tutorials/tutorial6.asp')");
menu.subMenus[2].addItem("Filters & Transitions","window.open('/tutorials/tutorial4.asp')");
menu.subMenus[2].addItem("Dhtml Library","window.open('/tutorials/tutorial3.asp')");
menu.subMenus[2].addItem("Document Size","window.open('/tutorials/tutorial2.asp')");
menu.subMenus[2].addItem("Dhtml Intro","window.open('/tutorials/tutorial1.asp')");
menu.subMenus[3].addItem("Forum listings","window.open('/forums')");
menu.subMenus[3].addItem("Cool Sites","window.open('/forums/forum.asp?FORUM_ID=1&CAT_ID=1&Forum_Title=Cool+sites')");
menu.subMenus[3].addItem("CoolMenus","window.open('/forums/forum.asp?FORUM_ID=2&CAT_ID=1&Forum_Title=CoolMenus')");
menu.subMenus[3].addItem("Cross Browser","window.open('/forums/forum.asp?FORUM_ID=3&CAT_ID=1&Forum_Title=Crossbrowser+DHTML')");
menu.subMenus[3].addItem("Scripts","window.open('/forums/forum.asp?FORUM_ID=4&CAT_ID=1&Forum_Title=DHTML+Scripts')");
menu.subMenus[3].addItem("General","window.open('/forums/forum.asp?FORUM_ID=6&CAT_ID=1&Forum_Title=General+DHTML+issues')");
menu.subMenus[3].addItem("Off-Topic","window.open('/forums/forum.asp?FORUM_ID=9&CAT_ID=1&Forum_Title=Off%2Dtopic')");
c = menu.subMenus[4].addItem("Cool Sites","toggle");
c.startAngle = 15;
menu.subMenus[4].addItem("Portals","window.open('/resources/default.asp?catid=7&cattitle=Portals')");
menu.subMenus[4].addItem("Script Sites","window.open('/resources/default.asp?catid=1&cattitle=Script+sites')");
menu.subMenus[4].addItem("Tutorials &<br>References","toggle");
menu.subMenus[4].subMenus[0].addItem("Comercial Sites","window.open('/resources/default.asp?catid=5&cattitle=Commercial+sites')");
menu.subMenus[4].subMenus[0].addItem("Personal Sites","window.open('/resources/default.asp?catid=6&cattitle=Personal+sites')");
menu.subMenus[4].subMenus[0].addItem("Experimental Projects","window.open('/resources/default.asp?catid=4&cattitle=Experimental+projects')");
menu.subMenus[4].subMenus[3].addItem("References","window.open('/resources/default.asp?catid=8&cattitle=References')");
menu.subMenus[4].subMenus[3].addItem("Tutorials & Articles","window.open('/resources/default.asp?catid=9&cattitle=Tutorials+and+Articles')");
//--></script>
빨간색 점을 마우스로 클릭해보세요. 그리고 그 위로 퍼져나가는 메뉴들도 클릭해보세요.
정말 쥑이지 않나요? 소스가 길다는게 흠입니다만 하나다로 틀리면 실행이 전혀 안됩니다.
수정 부분을 잘보시고 수정해주세요.
**********************************************************************************
DotMenu
* Copyright (C) 2001 <a href="/dhtmlcentral/dan_pupius.asp">Dan Pupius</a>
* This script was released at DHTMLCentral.com
* Visit for more great scripts!
* This may be used and changed freely as long as this msg is intact!
* We will also appreciate any links you could give us.
*
* Made by <a href="/dhtmlcentral/dan_pupius.asp">Dan Pupius</a>
**********************************************************************************
<head> 와 </head> 사이에 입력하세요.
<style type="text/css">
.dot { position: absolute; width: 6; height: 6; visibility: hidden; background-color: red; font-size: 1px; cursor: pointer; cursor: hand; z-index: 100 }
.dotoff { position: absolute; width: 6; height: 6; visibility: hidden; background-color: gray; font-size: 1px; cursor:default; z-index: 100}
.dotempty { position: absolute; width: 6; height: 6; visibility: hidden; background-color: orange; font-size: 1px; cursor: pointer; cursor: hand; zindex: 100 }
.caption { position: absolute; visibility: hidden; font-family: Tahoma; color: black;
font-size: 11px; text-align: Center; cursor: default; z-index:
1 }
body { margin: 0px; background-color: white; }
a { color: silver; text-decoration: none }
p { font-size: 10px; font-family: tahoma; color: black }
</style>
<script language="JavaScript" type="text/javascript">
function lib_bwcheck(){ //Browsercheck (needed)
this.ver=navigator.appVersion
this.agent=navigator.userAgent
this.dom=document.getElementById?1:0
this.opera5=this.agent.indexOf("Opera 5")>-1
this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;
this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
this.ie=this.ie4||this.ie5||this.ie6
this.mac=this.agent.indexOf("Mac")>-1
this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
this.ns4=(document.layers && !this.dom)?1:0;
this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
return this
}
var bw=new lib_bwcheck()
// The code of this script is in the body, the browsercheck above is not used.
</script>
<body> 와 </body>사이에 추가해주세요.
<script language="javascript1.2" type="text/javascript">
<!--
// DotMenu
// provides cross-browser functionality
//======================================
function getObjectRef(name) {
if(document.getElementById) return document.getElementById(name);
else if(document.all) return document.all[name];
else return null;
}
// general functions to assist the script
//========================================
function show(name) {
var el = getObjectRef(name);
if(el) el.style.visibility = "visible";
}
function hide(name) {
var el = getObjectRef(name);
if(el) el.style.visibility = "hidden";
}
function getWidth(name) {
var el = getObjectRef(name);
return el.offsetWidth;
}
function getHeight(name) {
var el = getObjectRef(name);
return el.offsetHeight;
}
function moveMe(name,x,y) {
var el = getObjectRef(name);
if(el) { el.style.top = parseInt(y); el.style.left = parseInt(x); }
}
function moveBy(name,x,y) {
var el = getObjectRef(name);
if(el) { el.style.top = parseInt(el.style.top) + parseInt(y); el.style.left = parseInt(el.style.left) + parseInt(x); }
}
// Creates the menu objects
//==========================
var menuCount = 0;
function menuObject(name,x,y,caption, r, parent) {
if ( (!document.getElementById&&!document.all) || navigator.userAgent.indexOf("Opera")>-1) return;
document.write('<div id="divDot' + menuCount + '" class="dotempty" style="top: ' + y + '; left: ' + x + '"></div>');
document.write('<div id="divCap' + menuCount + '" class="caption" style="top: 0; left: 0">' + caption + '</div>');
this.name = name;
this.parent = parent
this.ref = "divDot" + menuCount;
this.caption = "divCap" + menuCount
if(r) this.radius = r;
else this.radius = 400;
this.subMenus = new Array();
this.state = 0;
this.moving = false;
if(this.parent) this.action = "null";
else this.action = "toggle";
if(this.parent) this.startAngle = parent.startAngle;
else this.startAngle = 0;
getObjectRef(this.ref).objRef = this.name;
this.show = function() { show(this.ref); }
this.hide = function() { hide(this.ref); }
this.moveMe = function(x,y) { if(this.parent) { x += this.parent.x(); y += this.parent.y(); } moveMe(this.ref,x,y); }
this.moveBy = function(x,y) { moveBy(this.ref,x,y); }
this.x = function() { return parseInt(getObjectRef(this.ref).style.left); }
this.y = function() { return parseInt(getObjectRef(this.ref).style.top); }
this.w = function() { return getWidth(this.ref); }
this.h = function() { return getHeight(this.ref); }
this.showCaption = function() {
moveMe(this.caption, this.x() - (getWidth(this.caption)/2) + (this.w()/2), (this.y() + this.h()));
show(this.caption);
}
this.hideCaption = function() {
hide(this.caption);
}
this.setCaption = function(c) { getObjectRef(this.caption).innerHTML = c;}
this.addItem = function(c,action,r) {
getObjectRef(this.ref).className = "dot";
if(!r) r = this.radius/2;
var sub = new menuObject(this.name + ".subMenus[" + this.subMenus.length + "]",0,0,c,r,this);
sub.parent = this;
sub.action = action;
sub.moveMe(0,0);
this.subMenus[this.subMenus.length] = sub;
return sub;
}
this.expand = function() {
if(this.subMenus.length > 0) {
var p = true;
if(this.parent) {
p = !this.parent.moving;
for(var i=0; i<this.parent.subMenus.length;i++)
p = p && ((this.parent.subMenus[i].state==0) || (this.parent.subMenus[i].state==this.parent.subMenus[i].subMenus.length)) && (this.parent.subMenus[i].moving==false);
} else var o = false;
if((!this.parent || this.parent.state == this.parent.subMenus.length) && p) {
if(this.parent) this.collapseAll(this.name);
var diff = 360 / this.subMenus.length;
for(var i=0;i<this.subMenus.length;i++){
this.subMenus[i].moveMe(0,0);
this.subMenus[i].show();
this.moving = true;
this.subMenus[i].slide(this.subMenus[i].radius * cos(degToRad((diff*i)+this.startAngle)), this.subMenus[i].radius * sin(degToRad((diff*i)+this.startAngle)), this.name + ".subMenus[" + i + "].showCaption();" + this.name + ".moving=false;" + this.name + ".state+=1;");
}
if(this.parent){
getObjectRef(this.parent.ref).style.filter = "alpha (opacity=33)";
getObjectRef(this.parent.ref).style.MozOpacity = "33%";
getObjectRef(this.parent.ref).className = "dotoff";
getObjectRef(this.parent.caption).style.filter = "alpha (opacity=33)";
getObjectRef(this.parent.caption).style.MozOpacity = "33%";
for(i=0;i<this.parent.subMenus.length;i++) {
getObjectRef(this.parent.subMenus[i].ref).style.filter = "alpha (opacity=66)";
getObjectRef(this.parent.subMenus[i].ref).style.MozOpacity = "66%";
getObjectRef(this.parent.subMenus[i].caption).style.filter = "alpha (opacity=66)";
getObjectRef(this.parent.subMenus[i].caption).style.MozOpacity = "66%";
}
if(this.parent.parent) {
for(i=0;i<this.parent.parent.subMenus.length;i++) {
getObjectRef(this.parent.parent.subMenus[i].ref).style.filter = "alpha (opacity=33)";
getObjectRef(this.parent.parent.subMenus[i].ref).style.MozOpacity = "33%";
getObjectRef(this.parent.parent.subMenus[i].ref).className = "dotoff";
getObjectRef(this.parent.parent.subMenus[i].caption).style.filter = "alpha (opacity=33)";
getObjectRef(this.parent.parent.subMenus[i].caption).style.MozOpacity = "33%";
}
getObjectRef(this.parent.parent.ref).style.MozOpacity = "33%";
getObjectRef(this.parent.parent.ref).style.MozOpacity = "33%";
getObjectRef(this.parent.parent.ref).className = "dotoff";
}
}
getObjectRef(this.ref).style.filter = "alpha (opacity=66)";
getObjectRef(this.caption).style.filter = "alpha (opacity=66)";
getObjectRef(this.ref).style.MozOpacity = "66%";
getObjectRef(this.caption).style.MozOpacity = "66%";
}
}
}
this.collapse = function() {
var p = true;
p = !this.moving;
for(var i=0; i<this.subMenus.length;i++)
p = p && (this.subMenus[i].state==0) && (this.subMenus[i].moving==false);
if(p && this.subMenus.length > 0) {
for(var i=0;i<this.subMenus.length;i++){
this.subMenus[i].hideCaption();
this.moving = true;
this.subMenus[i].slide(0, 0, this.name + ".subMenus[" + i + "].hide();" + this.name + ".moving=false;" + this.name + ".state-=1;");
}
if(this.parent){
getObjectRef(this.parent.ref).style.filter = "alpha (opacity=66)";
getObjectRef(this.parent.ref).style.MozOpacity = "66%";
if(this.parent.subMenus.length != 0)
getObjectRef(this.parent.ref).className = "dot";
else
getObjectRef(this.parent.ref).className = "dotempty";
getObjectRef(this.parent.caption).style.filter = "alpha (opacity=66)";
getObjectRef(this.parent.caption).style.MozOpacity = "66%";
for(i=0;i<this.parent.subMenus.length;i++) {
getObjectRef(this.parent.subMenus[i].ref).style.filter = "alpha (opacity=100)";
getObjectRef(this.parent.subMenus[i].ref).style.MozOpacity = "100%";
if(this.parent.subMenus[i].subMenus.length != 0)
getObjectRef(this.parent.subMenus[i].ref).className = "dot";
else
getObjectRef(this.parent.subMenus[i].ref).className = "dotempty";
getObjectRef(this.parent.subMenus[i].caption).style.filter = "alpha (opacity=100)";
getObjectRef(this.parent.subMenus[i].caption).style.MozOpacity = "100%";
}
if(this.parent.parent) {
for(i=0;i<this.parent.parent.subMenus.length;i++) {
getObjectRef(this.parent.parent.subMenus[i].ref).style.filter = "alpha (opacity=66)";
getObjectRef(this.parent.parent.subMenus[i].ref).style.MozOpacity = "66%";
if(this.parent.parent.subMenus[i].subMenus.length != 0)
getObjectRef(this.parent.parent.subMenus[i].ref).className = "dot";
else
getObjectRef(this.parent.parent.subMenus[i].ref).className = "dotempty";
getObjectRef(this.parent.parent.subMenus[i].caption).style.filter = "alpha (opacity=66)";
getObjectRef(this.parent.parent.subMenus[i].caption).style.MozOpacity = "66%";
}
}
}
getObjectRef(this.ref).style.filter = "alpha (opacity=100)";
getObjectRef(this.caption).style.filter = "alpha (opacity=100)";
getObjectRef(this.ref).style.MozOpacity = "100%";
getObjectRef(this.caption).style.MozOpacity = "100%";
}
}
this.collapseAll = function(except) {
for(var i=0;i<this.parent.subMenus.length;i++) {
if(this.parent.subMenus[i].name!=except && this.parent.subMenus[i].state==this.parent.subMenus[i].subMenus.length) {
this.parent.subMenus[i].collapse();
}
}
}
this.toggle = function(e) {
if(document.all) id = window.event.srcElement;
else id = e.target;
var dot = eval(id.objRef);
if(dot.state==0 && !dot.moving) dot.expand();
else if(dot.state==dot.subMenus.length && !dot.moving) dot.collapse()
}
this.doAction = function(e) {
if(document.all) id = window.event.srcElement;
else id = e.target;
var dot = eval(id.objRef);
if(dot.action == "toggle") dot.toggle(e);
else eval(dot.action);
}
//change these if you want to change the events that trigger the actions
//========================================================================
//getObjectRef(this.ref).onmousemove = this.toggle;
getObjectRef(this.ref).onmouseup = this.doAction;
this.slide = function(xx,yy,func) {
if(!func) func = "";
var px = this.parent.x();
var py = this.parent.y();
var x = xx - this.x() + px;
var y = yy - this.y() + py;
var d = sqrt(square(xx-this.x() + px) + square(yy-this.y() + py));
var v = d/8;
if(v<1) v = 1;
if( (Math.abs(x) < v) && (Math.abs(y) < v) ) {
moveMe(this.ref,xx + px,yy + py);
if(func != "") eval(func);
} else {
var a = round(atan(x,y));
dx = round(v * cos(degToRad(a)));
dy = round(v * sin(degToRad(a)));
this.moveBy(dx,dy);
setTimeout(this.name + ".slide(" + xx + "," + yy + ", '" + func + "');",10);
}
}
// Preoading the windows filters.
if (menuCount==0 && document.all) document.all[this.ref].style.filter = "alpha (opacity=100)";
menuCount++;
return this;
}
// Math functions
//================
var pi = Math.PI;
function square(x) { return (x*x); }
function sqrt(x) { return Math.sqrt(x); }
function round(x) { return Math.round(x); }
function rand(x,y) { return (round(Math.random()*(y-x)) + x); }
function cos(x) { return Math.cos(x) }
function sin(x) { return Math.sin(x) }
function degToRad(x) { return ( x/(360/(2*pi)) ); }
function radToDeg(x) { return ( x*(360/(2*pi)) ); }
function atan(s,t) {
if( s == 0.0 && t > 0.0)
angle = 90.0;
else if(s == 0.0 && t < 0.0)
angle = 270.0;
else if (s < 0.0 )
angle = 180.0 + radToDeg(Math.atan(t/s));
else if (s > 0.0 && t < 0.0)
angle = 360.0 + radToDeg(Math.atan(t/s));
else {
if(s==0.0) s=0.00001;
angle = radToDeg(Math.atan(t/s));
}
if(angle < 0.0) angle += 360.0;
return angle;
}
//====================================================================================
// make the menus and provide information on usage
//====================================================================================
//
// In order to customise your menus all you need to do is:
// - edit the styles .dot, .dotoff and .caption
// - add the main menu using the following code
// var [menu_name] = new menuObject("[menu_name]", [x position], [y position], [caption], [spacing between sub menus]);
// - add the subemus using:
// var [sub_menu] = [menu_name].addItem([caption],[action],[spacing]);
// OR
// var [sub-sub_menu] = [sub_menu].addItem([caption],[action],[spacing]);
// OR
// [menu_name].subMenus[x].addItem([caption],[action],[spacing]);
//
// - where action is string that get's evaluated when the dot is clicked
//
// (NOTE the spacing is optional and if left blank gets inherited
// and is equal to the (parent's value)/2 - the default for
// the main menu item uis 400)
//
// - the following allow extra manipulation of the menus:
// + menuItem.show() - show's the menu's dot
// + menuItem.showCaption() - show's the menu's caption
// + menuItem.hide()
// + menuItem.hideCaption()
// + menuItem.startAngle = x - default is 0-degrees which means the first submenu appears
// directly to the right, the following items are traced in a
// clockwise direction
// + menuItem.setCaption("text") - allows you to change a menus caption
// + menuItem.expand() - opens a menus submenus (if they exist)
// + menuItem.collapse() - closes a menu's subItems (unless one of them is open)
//
// + menuItem.moveMe(x,y) - moves a menu to coordinates (x,y)
// + menuItem.moveBy(x,y) - moves a menu by (x,y)-pixels
// + menuItem.x() & menuItem.y() - retrieve a menus coordinates
//
//====================================================================================
//get dimentions of the page
if(document.all) pageWidth = document.body.offsetWidth-20;
else pageWidth = innerWidth;
if(document.all) pageHeight = document.body.offsetHeight-4;
else pageHeight = innerHeight;
//Create main menu
var menu = new menuObject("menu",pageWidth/2,pageHeight/2,"Yoonmi.net",pageHeight/2);
menu.startAngle = -90;
//show menu and caption
menu.show();
menu.showCaption();
//Add submenus
menu.addItem("news","window.open('주소')");
menu.addItem("scripts","toggle");
menu.addItem("tutorials","toggle");
menu.addItem("forums","toggle");
menu.addItem("resources","toggle");
menu.subMenus[1].addItem("FoldOutMenu","window.open('/script/script22.asp')");
menu.subMenus[1].addItem("Loading Bar","window.open('/script/script17.asp')");
menu.subMenus[1].addItem("Window Script","window.open('/script/script16.asp')");
menu.subMenus[1].addItem("PageSlideFade","window.open('/script/script15.asp')");
menu.subMenus[1].addItem("Circle Menu","window.open('/script/script14.asp')");
menu.subMenus[1].addItem("Annimation Intro","window.open('/script/script9.asp')");
menu.subMenus[1].addItem("NewsSlideFade","window.open('/script/script10.asp')");
menu.subMenus[1].addItem("Other Scripts","window.open('/script/')");
menu.subMenus[2].addItem("Scripting for vs5 browsers","window.open('/tutorials/tutorial5.asp')");
menu.subMenus[2].addItem("Makeing a Dhtml Script","window.open('/tutorials/tutorial6.asp')");
menu.subMenus[2].addItem("Filters & Transitions","window.open('/tutorials/tutorial4.asp')");
menu.subMenus[2].addItem("Dhtml Library","window.open('/tutorials/tutorial3.asp')");
menu.subMenus[2].addItem("Document Size","window.open('/tutorials/tutorial2.asp')");
menu.subMenus[2].addItem("Dhtml Intro","window.open('/tutorials/tutorial1.asp')");
menu.subMenus[3].addItem("Forum listings","window.open('/forums')");
menu.subMenus[3].addItem("Cool Sites","window.open('/forums/forum.asp?FORUM_ID=1&CAT_ID=1&Forum_Title=Cool+sites')");
menu.subMenus[3].addItem("CoolMenus","window.open('/forums/forum.asp?FORUM_ID=2&CAT_ID=1&Forum_Title=CoolMenus')");
menu.subMenus[3].addItem("Cross Browser","window.open('/forums/forum.asp?FORUM_ID=3&CAT_ID=1&Forum_Title=Crossbrowser+DHTML')");
menu.subMenus[3].addItem("Scripts","window.open('/forums/forum.asp?FORUM_ID=4&CAT_ID=1&Forum_Title=DHTML+Scripts')");
menu.subMenus[3].addItem("General","window.open('/forums/forum.asp?FORUM_ID=6&CAT_ID=1&Forum_Title=General+DHTML+issues')");
menu.subMenus[3].addItem("Off-Topic","window.open('/forums/forum.asp?FORUM_ID=9&CAT_ID=1&Forum_Title=Off%2Dtopic')");
c = menu.subMenus[4].addItem("Cool Sites","toggle");
c.startAngle = 15;
menu.subMenus[4].addItem("Portals","window.open('/resources/default.asp?catid=7&cattitle=Portals')");
menu.subMenus[4].addItem("Script Sites","window.open('/resources/default.asp?catid=1&cattitle=Script+sites')");
menu.subMenus[4].addItem("Tutorials &<br>References","toggle");
menu.subMenus[4].subMenus[0].addItem("Comercial Sites","window.open('/resources/default.asp?catid=5&cattitle=Commercial+sites')");
menu.subMenus[4].subMenus[0].addItem("Personal Sites","window.open('/resources/default.asp?catid=6&cattitle=Personal+sites')");
menu.subMenus[4].subMenus[0].addItem("Experimental Projects","window.open('/resources/default.asp?catid=4&cattitle=Experimental+projects')");
menu.subMenus[4].subMenus[3].addItem("References","window.open('/resources/default.asp?catid=8&cattitle=References')");
menu.subMenus[4].subMenus[3].addItem("Tutorials & Articles","window.open('/resources/default.asp?catid=9&cattitle=Tutorials+and+Articles')");
//--></script>
댓글 17
-
▩윤미
2002.06.09 20:54
-
반죽왕
2002.06.09 21:59
예제는 크기가 작아서 그런건지...글씨들이 너무 겹친다는게 흠이네염.....
그래도 좋은 강의 감사욤.. -
ssa2co
2002.06.09 22:02
진짜 이쁘네여^-^ 근데.;; 넘 길구 어려워요.; 쿨럭.; -
주여리
2002.06.09 23:23
mywizz에 올라왔던것인데... 둥둥..ㅋㅋ(농담) -
강명지
2002.06.09 23:47
엄청납니다... -
Ani-cast.net
2002.06.09 23:53
위쯔홈페이지에 올라왔던것이죠.. NeZZ라는 분이 아마 DHTML로 만들었다죠? -
박용철
2002.06.10 00:02
/**********************************************************************************
DotMenu
* Copyright (C) 2001 <a href="/dhtmlcentral/dan_pupius.asp">Dan Pupius</a>
* This script was released at DHTMLCentral.com
* Visit for more great scripts!
* This may be used and changed freely as long as this msg is intact!
* We will also appreciate any links you could give us.
*
* Made by <a href="/dhtmlcentral/dan_pupius.asp">Dan Pupius</a>
*********************************************************************************/ -
▩윤미
2002.06.10 01:18
아 그렇군요. 수정해서 카피라이터 넣도록 하겠습니다. -
i-DADA
2002.06.10 01:49
이거; 다른 곳에서 봣는데;ㅣ 커피라이터 까지 -
하놈
2002.06.10 10:29
http://dynamicdrive.com에서 있던거 아닌가요?
많이 본 소스^^ -
▩윤미
2002.06.10 14:26
떠도는 공개소스죠 ^^; -
슈가캔댜;
2002.06.13 13:29
굉장히길군요 -_-; , 차마손대기가, 무서워집니다; -
메이초롱
2002.10.12 23:33
오오오-_-)b 추천 누르고 갑니다. -
pato
2003.01.26 21:47
윤미네강좌를 딴데서 보면 어디다 신고하라굽쇼..
사이버수사대에??????????????? -
IriSiRin─━★
2003.01.31 14:50
이거 외국에 있는 소스인데..저작권있는 소스입니다. 매일링으로 와서 받아봤음 -
IriSiRin─━★
2003.01.31 14:51
자바스크립트라기보다는 dhtml에 가깝다던뎅.--;잘모르겠땁 -
유난영
2005.01.21 20:31
길긴해도 너무 좋아요
제목 | 글쓴이 | 날짜 |
---|---|---|
팝업창에서 부모창 링크 제어하기(노프레임 및 프레임 적용가능) [9] | 양지다컴 | 2002.06.17 |
접속할때마다 바뀌는 제목표시줄 | 오토™ | 2002.06.16 |
강추!! 요리조리 날라다니는 놈을 잡아랏...!! ;; [6] | 키르(絶對) | 2002.06.14 |
배경색과 글자색같이 변화시키기 2 | keymove | 2002.06.14 |
배경색과 글자색같이 변화시키기 | keymove | 2002.06.14 |
클릭으로 배경이미지 변경 [4] | keymove | 2002.06.14 |
웹상에서도 내맘데로 이미지 크기를 조절할 수 있다?? [9] | ▩윤미 | 2002.06.13 |
뭐 다 할줄아시겠지만 -_- absolute positioning [3] | [º^^º]MISO | 2002.06.13 |
랜덤메시지 + 흐르는 메세지 [4] | keymove | 2002.06.13 |
[수정] 랜덤배경음악 + 폼버튼 [1] | keymove | 2002.06.13 |
원하는시간에 팝업창을 띄우고 원하는 시간에 닫어뻐리는;; [2] | 키르(絶對) | 2002.06.13 |
부드럽게 스크롤바를 따라다니는..+_+ [6] | 키르(絶對) | 2002.06.13 |
플래쉬 효과나는 신비 메뉴 - -? *수정+카피라이터~ [17] | ▩윤미 | 2002.06.09 |
자바스크립트 이해하기...3 [1] | Eccen | 2002.06.05 |
서서히 이미지를 변경시켜주는 환상적인 룰오버효과 [7] | ▩윤미 | 2002.05.31 |
마우스에 축구공 따라다니는 자바 스크립트.. [6] | MR.HMH | 2002.05.30 |
어설픈 링크방지[정확한 경로로 오세요] [5] | 이성영 | 2002.05.30 |
자바스크립트 이해하기...2 [1] | Eccen | 2002.05.30 |
자바스크립트 이해하기...1 [13] | Eccen | 2002.05.26 |
폼안의 텍스트 입력시 실시간 카운팅 ? [8] | 카멜롯™ | 2002.05.20 |
menu.subMenus[1].addItem("FoldOutMenu","window.open('/script/script22.asp')");
이부분을 예로 들자면
FoldOutMenu 이게 메뉴 이름이고
'/script/script22.asp' 요부분을 해당 주소로 바꿔주시면 새창이 오픈되어 나타납니다.