我试图在侧面导航中突出显示特定的 div onclick 链接。到目前为止,它可以工作(在默认页面上),但是当您转到不同的页面然后单击侧面导航中的项目时,它将锚定到指定的 div,但不会突出显示。我需要重新点击链接才能突出显示。
var App = {
SetBaseLine: function() {
jQuery("#priceRange, #satisfaction").removeClass("activeListColor");
}
};
jQuery(document).ready(function() {
jQuery('a#priceLink').click(function(e) {
App.SetBaseLine();
jQuery('#priceRange').addClass('activeListColor');
});
jQuery('a#satisfactionLink').click(function(e) {
App.SetBaseLine();
jQuery('#satisfaction').addClass('activeListColor');
});
<div id="priceRange">
<div class="header">Price Range<br /><a id="button1" href="javascript:toggle3('colcontent1','button1');" ><img src="images/more-info-button.png" width="76" height="20" /></a></div>
<div class="col2 topSpace">Packages start at $29.99/month</div>
<div class="col3"><span>Best Value</span><img src="images/red-trophy.png" class="trophy" /><br />Packages start at $19.99/month</div>
<div class="col4 topSpace">Packages start at $29.99/month</div>
</div> <!-- End of priceRange div -->
<div id="satisfaction">
<div class="header">Customer Satisfaction <br /><a id="button2" href="javascript:toggle3('colcontent2','button2');" ><img src="images/more-info-button.png" width="76" height="20" /></a></div>
<div class="col2 topSpace">American Customer Satisfaction Index (ACSI) Rating: 68 </div>
<div class="col3"><span>Most Popular</span><img src="images/red-trophy.png" class="trophy" /><br />American Customer Satisfaction Index (ACSI) Rating: 71 </div>
<div class="col4 topSpace">American Customer Satisfaction Index (ACSI) Rating: 61 </div>
</div> <!-- End of satisfaction div -->
有什么建议么??