這裏我有與它如何更改活動菜單項內的圖像相應
例如不同的圖標菜單和菜單項,我有(HomeIcon)HomeText /(AppleIcon)AppleText /(OrangeIcon)OrangeText。
所有這些都將用戶重定向到我的頁面中的相應部分。
一旦我進入主頁部分,菜單項的背景將從白色變爲黑色因爲我在我的JQuery中添加了「活動」類。
結果,活動項目的黑色圖標總是隱藏...
如果我能在白色相同的圖標,我怎麼能動態改變圖像的URL?
請幫忙!
更新
/*Javascript*/
/*Javascript to remove and add class ".active" to the tag <li> */
/*CSS*/
ul li.active a p
{
color:white
}
<!--HTML-->
<ul id="menu">
\t <li class="active">
\t \t <a href="#firstPage">
\t \t \t <image src="imgs/menu/home.png" class="menuicon" />
\t \t \t <p class="menutext">Home<p>
\t \t </a>
\t </li>
\t <li>
\t \t <a href="#secondPage">
\t \t \t <image src="imgs/menu/apple.png" class="menuicon" />
\t \t \t <p class="menutext">Apple<p>
\t \t </a>
\t </li>
\t <li>
\t \t <a href="#3rdPage">
\t \t \t <image src="imgs/menu/orange.png" class="menuicon" />
\t \t \t <p class="menutext">Orange<p>
\t \t </a>
\t </li>
</ul>
給定的代碼示例,請。 我會想象沿着jQuery(「你的圖像選擇器」)。attr(「src」,「http:www.newimageurl.com/image.jpg」)。雖然 – Elentriel