![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 110 Pomógł: 3 Dołączył: 12.03.2011 Skąd: Opole Ostrzeżenie: (0%) ![]() ![]() |
witam ,mam problem ze skryptem zmiany stylu css, napisalem funkcje zmieniajaca plynnie dana wartosc stylu do podanego parametru,zainicjowanie nastepuje przez zdarzenie onmouseover a onmouseout ma za zadanie wyzerowac timer wczesniejszy i plynnie przywrocic parametr stylu,i tu wlasnie jest problem ..prosze o pomoc...(z js wlasnie zaczynam)
<!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>Dokument bez tytułu</title> <script type="text/javascript"> function start(obj,wartosc,styll){ if (obj.currentStyle){ var s=obj.currentStyle[styll]; var od=parseInt(s); } else { var w=window.getComputedStyle(obj, null)[styll]; var od=parseFloat(w); } clearInterval(); setInterval(run,15); function run(){ if(od<wartosc){ ++od; } else if (od>wartosc){ --od; } else { clearInterval(); } obj.style[styll]=od+'px'; } } </script> <style type="text/css"> div { background-color: #069; height: 40px; width: 40px; float:left; margin:5px; } </style> </head> <body> <div onmouseover="start(this,'200','height');" onmouseout="start(this,'40','height');"></div> <div onmouseover="start(this,'200','height');" onmouseout="start(this,'40','height');"></div> <div onmouseover="start(this,'200','height');" onmouseout="start(this,'40','height');"></div> </body> </html> |
|
|
![]() ![]() |
![]() |
Aktualny czas: 22.08.2025 - 21:01 |