Autor | Zpráva | ||
---|---|---|---|
maks Profil |
#1 · Zasláno: 31. 8. 2010, 12:05:24 · Upravil/a: maks
Ahoj,
potřeboval bych poradit s úpravou jednoho scriptu, jedná se o plynulé horizontální posouvání pomocí šipeček a JS. Našel jsem tenhle web http://www.thehorizontalway.com/, kde je něco podobného udělané, ale potřeboval bych ten script modifikovat z celého body na jeden div. JS, který to má na starosti, je zde, HTML šipek je nálsedující (kvůli ID atributům): <div id="arrows"> <ul> <li id="arleft"><a href="javascript://" title="go left">go left</a></li> <li id="arright"><a href="javascript://" title="go right">go right</a></li> </ul> </div> Já mám udělané HTML, je to seznam s ID realisation-summary (nastavená šířka 2000px), položky mají float: left (10 x 200px). V JS je tedy třeba změnit funkci z body na getElementById('realisation-summary'), ale trochu se ztrácím v tom dlouhém skriptu, moc se v tom neorientuji :( Zatím změny, které jsem provedl, jsou následující: - ř. 37-47 // PUVODNI getScrollLeft: function(){ if(document.all) return (document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : document.body.scrollLeft; else return window.pageXOffset; }, getWindowWidth: function(){ if (window.innerWidth) return window.innerWidth; if(document.documentElement && document.documentElement.clientWidth) return document.documentElement.clientWidth; }, getDocumentWidth: function(){ if (document.width) return document.width; if(document.body.offsetWidth) return document.body.offsetWidth; }, // MOJE UPRVA getScrollLeft: function(){ if(getElementById('realisation-summary')) return (document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : getElementById('realisation-summary').scrollLeft; else return window.pageXOffset; }, getWindowWidth: function(){ return 500; // výška nadřazeného elementu #content, ta je 500px }, getDocumentWidth: function(){ if (getElementById('realisation-summary').width) return getElementById('realisation-summary').width; if(getElementById('realisation-summary').offsetWidth) return getElementById('realisation-summary').offsetWidth; }, ale stále to nejde. Přiznám se, že někde bylo document.all, někde document.body (obojí jsem změnil takto), guláš, jaký z toho mám, se jen zahustil :(. Toto samotné nefunguje (pokud jsem to zaměnil dobře) Díky za ochotu, pokud se na to nkdo bude chtít mrknout, jak to vlastně funguje. Maks |
||
maks Profil |
#2 · Zasláno: 31. 8. 2010, 14:17:30
Vyřešeno jiným, ne tak robustním scriptem, který taky dostačuje pro účel, který potřebuji.
|
||
Chamurappi Profil |
#3 · Zasláno: 31. 8. 2010, 14:58:27
Reaguji na makse:
„if(getElementById('realisation-summary'))“ Ta metoda je document.getElementById .
|
||
Časová prodleva: 14 let
|
Toto téma je uzamčeno. Odpověď nelze zaslat.
0