I'm using some code I found to highlight an id after clicking an anchor link.
I'd like to modify this to instead highlight the next <dd>
tag in a definition list:
<dl class="mainfaq">
<dt id="q1">Q1</dt>
<dd><p>A1</p></dd>
<dt id="q2">Q2</dt>
<dd><p>A2</p></dd>
<dt id="q3">Q3</dt>
<dd><p>A3</p></dd>
</dl>
Here is the jquery from Lincoln Loop
function highlight(elemId){
var elem = $(elemId);
elem.css("backgroundColor", "#ffffff"); // hack for Safari
elem.animate({ backgroundColor: '#ffffaa' }, 1500);
setTimeout(function(){$(elemId).animate({ backgroundColor: "#ffffff" }, 3000)},1000);
}
if (document.location.hash) {
highlight(document.location.hash);
}
$('a[href*=#]').click(function(){
var elemId = '#' + $(this).attr('href').split('#')[1];
highlight(elemId);
});
I can't seem to get the usual .next or .sibling modifications to work.