Zaloguj | Zarejestruj | FAQ
Anonymous

Help?

+ Odpowiedz

Posty: 13 1, 2


Re: Help?

przez XainPro » Pt sie 24, 2012 4:21 am

there is an Event called onMouseOut add on mouse out event at your coin and call this function name
hideAwardBox()

i.e
onmouseout="hideAwardBox()"
Avatar użytkownika

XainPro

  • Posty: 3933
  • Dołączył(a): Pt lut 17, 2012 8:10 pm

Re: Help?

przez soccerwebsitemaker » N sie 26, 2012 3:19 am

So yeah, the problem right now is that it only fades away the first time you hover over it, it doesn't fade out any other time (unless you refresh, not acceptable)



Also, I shortened my code but it still didn't work.



New Code (still needs fixing):



JavaScript:






var ts = 0;

var DBVAR = "Rewards:<br>+120 Coins<br>+10 Skill Points<br>+1 Award";

var ADVAR = "You have already completed this achievement";

function addAward()

{

var divTag = document.createElement("div");

divTag.id = "newachievementdiv";

divTag.setAttribute("align","center");

divTag.style.margin = "0px auto";

divTag.style.position = "fixed";

divTag.style.left = "250px";

divTag.className = "awardBox";

if (ts == 0)

{

divTag.innerHTML = "Congratulations! You have <span class='highlite-blue'>found the secret coin</span>!<br>" + DBVAR;

ts = 1;

}

else

{

divTag.innerHTML = "Congratulations! You have <span class='highlite-blue'>found the secret coin</span>!<br>" + ADVAR;

ts = 1;

}

setInterval(hideAwardBox, 5000);

document.body.appendChild(divTag);

}

function hideAwardBox()

{

$('#newachievementdiv').fadeOut('slow');

}






HTML (same):



<div id="secretcoin" onmouseover="addAward()">

</div>




Please review for me
Avatar użytkownika

soccerwebsitemaker

  • Posty: 138
  • Dołączył(a): So gru 31, 2011 6:25 pm
--
Coins. Profile. Games. Chat. Fun.

CoinAwards.

Check it out at http://www.coinawards.net63.net/

Re: Help?

przez XainPro » Wt sie 28, 2012 3:57 am

i did not get time to complete my code but here is an idea how you can do it efficiently.
Kod: Zaznacz cały
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script type="text/javascript">

var DBVAR = "Rewards:<br>+120 Coins<br>+10 Skill Points<br>+1 Award";
var ADVAR = "You have already completed this achievement";
var ABC = "Congratulations! You have <span class='highlite-blue'>found the secret coin</span>!<br>" + ADVAR;
var ts = 0;
$(document).ready(function() {

$("#secretcoin").mouseenter(function () {
//$("p").toggle( flip++ % 2 == 0 );
$("#newachievementdiv").toggle('slow', function() {
   if(ts == 0){
    // Animation complete.
   $("#newachievementdiv").html(DBVAR);
   $("#newachievementdiv").hide(8000);
   ts++;
   }
  });
});

});


/* {
   if(showOrhide) {
$("#newachievementdiv").html("Congratulations! You have <span class='highlite-blue'>found the secret coin</span>!<br>" + DBVAR);
      }

   }
}
*/

</script>
</head>

<body>


      


<div id="secretcoin" style="background-color:#000000; height:100px; width:100px;">

</div>

<div id="newachievementdiv" class="awardBox" style="display:none">
</div>

</body>
</html>
Avatar użytkownika

XainPro

  • Posty: 3933
  • Dołączył(a): Pt lut 17, 2012 8:10 pm


+ Odpowiedz

1, 2