Jump to content

javascript pitanje :)


ch1zra

Recommended Posts

'ello [:D]

evo mene, mucim se kao kaludjer s' kurcem (© moj matori).

dakle, da prvo bacim kod, pa da izlozim problem :)

html :

<div style="position: fixed; right: 10px; bottom: 5px; background: transparent; color: #cccccc; font-size: 9px; font-family: FixedSys; font-weight: normal;">

	<a href="#">\m/</a>

	<div id="downmenu">

		<a href="index.php">News <=</a><br>

		<a href="index.php?display=Quotes">Quotes <=</a><br>

		<a href="index.php?display=About">About <=</a><br>

		<a href="index.php?display=OpRules">OP Rules <=</a><br>

		<a href="index.php?display=UserRules">User Rules <=</a><br>

		<a href="index.php?display=Connect">Connect <=</a><br>

		<a href="index.php?display=Contact">Contact <=</a><hr>

	</div> 

</div>
deo css-a vezan za izvesni downmenu :
#downmenu {

	font-family: Verdana, Arial, Helvetica, sans-serif;

	font-size: 9px;

	position: fixed;

	bottom: 0px;

	right: 5px;

	top: auto;

	width: auto;

	color: #666666;

	text-align: right;

	padding: 10px;

	z-index: 100;

	visibility: hidden;

}
JS kod koji sam nasao :
<script language="JavaScript"><!--

function show(object) {

  if (document.getElementById) {

	document.getElementById(object).style.visibility = 'visible';

  }

  else if (document.layers && document.layers[object]) {

	document.layers[object].visibility = 'visible';

  }

  else if (document.all) {

	document.all[object].style.visibility = 'visible';

  }

}


function hide(object) {

  if (document.getElementById) {

	document.getElementById(object).style.visibility = 'hidden';

  }

  else if (document.layers && document.layers[object]) {

	document.layers[object].visibility = 'hidden';

  }

  else if (document.all) {

	document.all[object].style.visibility = 'hidden';

  }

}

//--></script>

elem, problem je sledeci :

zelim da kad se odradi mouseover prvi DIV (prazan link) drugi DIV, zvani #downmenu postane vidljiv.

Posle toga, zelim da na mouseover drugog DIV-a on postane hidden opet (kao sto bude i kad se strana ucita).

ali, jebe me event bubbling, pa meni pada na pamet da eventualno dam prvom DIVu odredjeni ID isto, pa da mouseover>show radi samo ako ga trigeruje taj odredjeni ID, i isto tako za mouseout>hide da ga trigeruje samo ID downmenu.

pa posto sam ja imba nubisha za JS, interesuje me moze li neko ko ima znanja i volje da mi pomogne ?

[:D]

Ko je nub ne budi mu drug.

I mean you harm.

Link to comment
Share on other sites

zato sto nije dovoljno interesantno uzimati gotove stvari, kad radis sam naucis ponesto :)

<div style="position: fixed; right: 10px; bottom: 5px; background: transparent; color: #cccccc; font-size: 9px; font-family: FixedSys; font-weight: normal;">

	<a href="#" onmouseover="show('downmenu')">\m/</a>

	<div id="downmenu" onmouseout="hide('downmenu')">

		<a href="index.php">News <=</a><br>

		<a href="index.php?display=Quotes">Quotes <=</a><br>

		<a href="index.php?display=About">About <=</a><br>

		<a href="index.php?display=OpRules">OP Rules <=</a><br>

		<a href="index.php?display=UserRules">User Rules <=</a><br>

		<a href="index.php?display=Connect">Connect <=</a><br>

		<a href="index.php?display=Contact">Contact <=</a><hr>

	</div> 

</div>

al to nece da radi, downmenu nestaje cim mi mis napusti \m/ link :|

//edit typo

Edited by ch1zra

Ko je nub ne budi mu drug.

I mean you harm.

Link to comment
Share on other sites

Pozdrav ch1zr0 hakeru,

kažeš neće da ostane div id="downmenu" kad miš ode sa linka \m/... Brzo i prljavo rešenje koje mi pada na pamet je

............

............

<a href="#" onmouseover="show('downmenu')" onmouseout="show('downmenu')">\m/</a>

<div id="downmenu" onmouseout="hide('downmenu')">

............

............

............

U principu bi ovo trebalo odraditi samo sa css-om i html-om + javascript za IE (jerbo ne podržava hover css). Na http://www.dynamicdrive.com/ ćeš sigurno pronaći rešenje.

Pozdrav Johnnz.

Link to comment
Share on other sites

Ček, polako

1. Kada miš napusti \m/ link i ne pređe na downmenu div da li i dalje ostaje vidljiv downmenu?To je ono sto si hteo?

2. Za ovo da nestaje kada pređe na downmenu div probaj da izbaciš onmouseout. Znači <div id="downmenu"> pa kad uradiš mouseover nekog drugog diva ubaci onmouseover="hide('downmenu')"

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...