Ocena wątku:
- 0 głosów - średnia: 0
- 1
- 2
- 3
- 4
- 5
[css] aktywny link
|
Liczba postów: 5
Liczba wątków: 3
Dołączył: 13-03-2012
Reputacja:
0
Witam. Zrobiłem menu obrazkowe, po najechaniu zmienia się grafika na inna. Chciałbym, aby po kliknięciu na odnośnik został on aktywny (zmienił się tak jak po najechaniu). Można to zrobić w CSS? Z góry dzięki za odp.
Liczba postów: 250
Liczba wątków: 39
Dołączył: 04-01-2009
Reputacja:
8
Liczba postów: 5
Liczba wątków: 3
Dołączył: 13-03-2012
Reputacja:
0
aktualnie mam menu wygenrowane przez DW.
js
Kod: <script type="text/javascript">
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
i kod obrazkowy:
Kod: <div class="menu"><body onload="MM_preloadImages('images/menu_red_en_03.gif','images/menu_red_en_05.gif','images/menu_red_en_08.gif','images/menu_red_en_11.gif')">
<a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image1','','images/menu_red_en_03.gif',1)"><img src="images/menu_gray_en_03.gif" name="Image1" width="104" height="32" border="0" id="Image1" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image2','','images/menu_red_en_05.gif',1)"><img src="images/menu_gray_en_05.gif" name="Image2" width="76" height="32" border="0" id="Image2" /></a>
<a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image3','','images/menu_red_en_08.gif',1)"><img src="images/menu_gray_en_08.gif" name="Image3" width="74" height="31" border="0" id="Image3" /></a>
<a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image4','','images/menu_red_en_11.gif',1)"><img src="images/menu_gray_en_11.gif" name="Image4" width="90" height="31" border="0" id="Image4" /></a>
</div>
Liczba postów: 2,411
Liczba wątków: 14
Dołączył: 10-08-2009
Reputacja:
132
Wyrzuć w piździet ten DW. Ten kod jest masakrycznie zły.
Poczytaj w necie na temat CSS Sprite Menu. Jest tego pod dostatkiem. Jest to o wiele prostsza i lepsza metoda.
A aktywny link to się robi albo JS albo PHP - zależnie od tego do czego ci ten aktywny link potrzebny
Liczba postów: 169
Liczba wątków: 25
Dołączył: 23-10-2011
Reputacja:
7
Jaki program super by nie było nie polecam generowania czegokolwiek. Lepiej zrobić samemu.
Pomogłem? To daj plusa
|
Podobne wątki… |
Wątek: |
Autor |
Odpowiedzi: |
Wyświetleń: |
Ostatni post |
|
skrypt uruchamiajacy nowy link |
Arnimarl |
1 |
2,887 |
26-05-2014, 00:34
Ostatni post: Kartofelek
|
|
[JAVASCRIPT] Link przewijanie |
cryptarithm |
5 |
3,659 |
24-08-2012, 14:28
Ostatni post: kornell
|
|
Flash jako link ładujący stronę do diva |
w4wer |
1 |
2,885 |
12-03-2012, 16:16
Ostatni post: Kartofelek
|
|
Link aktywny nie do konca aktywny ;/ |
Filuper112 |
20 |
14,114 |
15-06-2011, 20:03
Ostatni post: nd_macias
|
|
przeźroczyste PNG jako link nie działa w IE |
Jacobee |
5 |
5,219 |
31-03-2011, 14:05
Ostatni post: Jacobee
|
Użytkownicy przeglądający ten wątek: 1 gości
|
|
Sponsorzy i przyjaciele
|
|
|