scrolling v javascripte

Programovacie jazyky, rady, poradňa...
ehm123
King
King
Príspevky: 1658
Registrovaný: 27 feb 2006, 6:45
Bydlisko: PD / Praha

scrolling v javascripte

Príspevok od používateľa ehm123 »

napísal by mi niekto skrolovanie v js aby obrazky v nejakom ramci isli s lava do prava niečo take ako je na triko.sk (tie tricka ) ale nie z hora dole ale z lava do prava...dufam ze som to vysvetlil ako clovek
chrono
VIP
VIP
Používateľov profilový obrázok
Príspevky: 7127
Registrovaný: 25 dec 2006, 15:17

Príspevok od používateľa chrono »

Originál toho skriptu je TU
Neviem či tam chceš to posúvanie keď si nad šípkou, alebo tam chceš automatické posúvanie. Upravil som ten skript, aby sa v ňom rolovalo horizontálne (takže sa pozri, ako to funguje):
Prílohy
scroll.rar
(4.27 KiB) 63 stiahnutí
ehm123
King
King
Príspevky: 1658
Registrovaný: 27 feb 2006, 6:45
Bydlisko: PD / Praha

Príspevok od používateľa ehm123 »

ale praveze mam jeden problem...ten web je v X-HTML Transitional a ked to dam do neho tak neviem ako vyriesit


Kód: Vybrať všetko

Error  Line 21 column 25: there is no attribute "onMouseover".

	<a href="#" onMouseover="moveleft()" onMouseout="clearTimeout(moveleftvar)"><im

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.

chrono
VIP
VIP
Používateľov profilový obrázok
Príspevky: 7127
Registrovaný: 25 dec 2006, 15:17

Príspevok od používateľa chrono »

Vyskúšaj:

Kód: Vybrať všetko

<a href="#" onmouseover="moveleft()" onmouseout="clearTimeout(moveleftvar)">
ehm123
King
King
Príspevky: 1658
Registrovaný: 27 feb 2006, 6:45
Bydlisko: PD / Praha

Príspevok od používateľa ehm123 »

chrono
VIP
VIP
Používateľov profilový obrázok
Príspevky: 7127
Registrovaný: 25 dec 2006, 15:17

Príspevok od používateľa chrono »

Keďže to má byť xhtml, odpadá podpora starších prehliadačov a teda sa môžu vyhodiť zastaralé tagy (layer a ilayer). Takisto sa môže ten javaskript zjednodušiť.

Ešte malá poznámka. Sú dva spôsoby, ako zmeniť rýchlosť:
1. zmeniť premennú speed (t.j. o koľko bodov sa ten obsah posunie)
2. zmeniť čas vo funkciách setTimeout (možno by sa pre to mala tiež urobiť premenná)
Prílohy
scroll.rar
(4.27 KiB) 65 stiahnutí
ehm123
King
King
Príspevky: 1658
Registrovaný: 27 feb 2006, 6:45
Bydlisko: PD / Praha

Príspevok od používateľa ehm123 »

dikas...velmi pekne. ++karma
Napísať odpoveď