I need to modify the css of .ui-state-active , .ui-widget-content .ui-state-active to the following:
.ui-state-active , .ui-widget-content .ui-state-active {
background-image: url('images/tab-over.png') !important;
}
However, when I do that I get the desired effect but other elements on the website get affected when clicked. I want this function only when I click a tab.
Is there a safer way to do this ?
Here is my html code:
<div id="tabs">
<div id="left-side">
</div>
<ul class="tab-menu">
<li id="home">
<a href="<%= Url.Action("GetCoreTab", "Tab") %>" class="a">
<b>
<div id="home" class="menu">
</div>
</b>
</a>
</li>
<li><a href="<%= Url.Action("GetDatesAndLocationTab", "Home") %>" class="a"><b>
<div id="dates-and-location" class="menu">
</div>
</b></a></li>
<li><a href="<%= Url.Action("GetTariffTab", "Home") %>" class="a"><b>
<div id="tariff" class="menu">
</div>
</b></a></li>
<li><a href="<%= Url.Action("GetCustomerInformationTab", "Tab") %>" class="a"><b>
<div id="customer-information" class="menu">
</div>
</b></a></li>
<li><a href="<%= Url.Action("GetRatesAndChargesTab", "Tab") %>" class="a"><b>
<div id="rates-and-charges" class="menu">
</div>
</b></a></li>
<li><a href="<%= Url.Action("GetPaymentsAndVouchersTab", "Tab") %>" class="a"><b>
<div id="payments-and-vouchers" class="menu">
</div>
</b></a></li>
<li><a href="<%= Url.Action("GetDeliveryAndCollectionTab", "Tab") %>" class="a"><b>
<div id="delivery-and-collection" class="menu">
</div>
</b></a></li>
<li><a href="<%= Url.Action("GetGeneralTab", "Tab") %>" class="a"><b>
<div id="general" class="menu">
</div>
</b></a></li>
<li><a href="<%= Url.Action("GetEquipmentAndOtherDriversTab", "Tab") %>" class="a">
<b>
<div id="equipment-and-other-drivers" class="menu">
</div>
</b></a></li>
<li><a href="<%= Url.Action("GetCustomerPreferencesTab", "Tab") %>" class="a"><b>
<div id="customer-preferences" class="menu">
</div>
</b></a></li>
<li><a href="<%= Url.Action("GetCustomerStatisticsTab", "Tab") %>" class="a"><b>
<div id="customer-statistics" class="menu">
</div>
</b></a></li>
</ul>
<div id="right-side">
</div>
</div>
WHOA! Way over-extending things here!
OK, First of all, jQuery is great, but it has already done the work. To do what you are trying to achieve, you don't need ANY JavaScript of any kind. Use simple CSS.
Watch:
As for that link I promised earlier, this blog post goes into much more depth about ez access to currently selected tabs "outside" of the "tabs events".
If I don't misunderstand your question, you could simply do as following:
You could put the code in the
select
event of the tab controlhttp://docs.jquery.com/UI/Tabs#event-select