JS code - Падащ бутон
Ако на някой му трябва помощ за нещо, относно кода ... да пита. Тествах го на различни браузъри - върви, въпреки че има някои неща дето не се интерпретират от всички ...
ДЕМО



<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title>Rubber</title>

<style type="text/css">

body {
background: silver;
}

.but_at {
color: silver;
background: black;
font-weight: bold;
width: 90;
position: absolute;
top: 10;
left: 10;
}


</style>

<script language="javascript">

var scrHeight = screen.height;
var but_1height = 10;
var speedy = 0;
var KotaBallancer = 50;
var functionStopper = 0;

function Loader()
{
document.getElementById('butt_1').style.position = 'absolute';
document.getElementById('butt_1').style.top = but_1height;
document.getElementById('butt_1').style.left = 450;
}
function Ballancer()
{
if(but_1height < scrHeight - 200)Downer();
else Upper();
}
function Downer()
{
document.getElementById('butt_1').style.top = but_1height;
but_1height = but_1height + speedy;
speedy = speedy + 0.05;
setTimeout('Ballancer();',speedy);
}
function Upper()
{
if(functionStopper == 350)
{
document.getElementById('butt_1').style.top = scrHeight - 200;
setTimeout("but_1height = 10; speedy = 0; KotaBallancer = 50; functionStopper = 0; var CreatedBy = 'SirSlaff'; document.getElementById('butt_1').style.top = but_1height;",3000);
}
else if(speedy > 0)
{
document.getElementById('butt_1').style.top = but_1height;
but_1height = but_1height - speedy;
speedy = speedy - 0.09;
functionStopper++;
setTimeout('Upper();',speedy);}
else {KotaBallancer = KotaBallancer + KotaBallancer; speedy = 0; Ballancer();
}
}



</script>

</head>
<body onload="Loader();">

<input type="button" id="butt_1" class="but_at" value="RUBBER" onfocus="if(this.blur)this.blur();" onclick="if(but_1height == 10)Ballancer();">

</body>
</html>





Вариация на падащ бутон: Winking


ДЕМО Инструкции: изберете тежест на бутона, като натиснете някой от бутоните в ляво. След това кликнете върху бутона в средата. Идеята е различното ускорение и отскок ...


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title>xRubber</title>

<style type="text/css">

body {
background: silver;
}

.but_at {
color: silver;
background: black;
font-size: 10;
font-weight: bold;
width: 90;
position: absolute;
}
#butt_1 {
top: 10;
left: 450;
}
#butt1 {
top: 10;
left: 10;
}
#butt2 {
top: 40;
left: 10;
}
#butt3 {
top: 70;
left: 10;
}
#butt4 {
top: 100;
left: 10;
}


</style>

<script language="javascript">

var scrHeight = screen.height;
var but_1height = 10;
var speedy = 0;
var KotaBallancer = 50;
var functionStopper = 0;

function Loader()
{
document.getElementById('butt_1').style.position = 'absolute';
document.getElementById('butt_1').style.top = but_1height;
document.getElementById('butt_1').style.left = 450;
but_1height = 10;
}
function Ballancer()
{
if(but_1height < scrHeight - 200)Downer();
else Upper();
Visi_menu();
}
function Downer()
{
document.getElementById('butt_1').style.top = but_1height;
but_1height = but_1height + speedy;
speedy = speedy + 0.05;
setTimeout('Ballancer();',speedy);
}
function Upper()
{
if(functionStopper == varer1)
{
document.getElementById('butt_1').style.top = scrHeight - 200;
setTimeout("but_1height = 10; speedy = 0; KotaBallancer = 50; functionStopper = 0; var CreatedBy = 'SirSlaff'; document.getElementById('butt_1').style.top = but_1height; Visi_menu();",1500);
}
else if(speedy > 0)
{
document.getElementById('butt_1').style.top = but_1height;
but_1height = but_1height - speedy;
speedy = speedy - varer2;
functionStopper++;
setTimeout('Upper();',speedy);}
else {KotaBallancer = KotaBallancer + KotaBallancer; speedy = 0; Ballancer();
}
}



var varer1 = 350;
var varer2 = 0.09;

function CorrectorVar(L_,K_,M_)
{
varer1 = L_;
varer2 = K_;
}

function Visi_menu()
{
if(but_1height == 10)
{
for(i = 1; i < 5; i++)
{
document.getElementById('butt' + i).style.visibility = 'visible';
}
}
else
{
for(j = 1; j < 5; j++)
{
document.getElementById('butt' + j).style.visibility = 'hidden';
}
}
}
</script>

</head>
<body onload="Loader();">

<input type="button" id="butt_1" class="but_at" value="RUBBER" onfocus="if(this.blur)this.blur();" onclick="if(but_1height == 10)Ballancer();">

<input type="button" id="butt1" class="but_at" value="много твърда" onclick="CorrectorVar(770,0.07);" onfocus="if(this.blur)this.blur();">
<input type="button" id="butt2" class="but_at" value="твърда" onclick="CorrectorVar(350,0.09);" onfocus="if(this.blur)this.blur();">
<input type="button" id="butt3" class="but_at" value="мека" onclick="CorrectorVar(220,0.11);" onfocus="if(this.blur)this.blur();">
<input type="button" id="butt4" class="but_at" value="много мека" onclick="CorrectorVar(100,0.17);" onfocus="if(this.blur)this.blur();">

</body>
</html>





/ Трябва да сте регистриран за да напишете коментар /
От: cakky
0:39 21-01-2011
Сайтът с най-много НЕработещи демота
1