content doesn't append to div after hover
http://jsfiddle.net/A3uMK/
Hover the links, the content in <dd>
doesn't appear in the div, anybody mind 开发者_如何转开发helping?
That's because the div doesn't appear. You forgot to show the div.
$('div').html($data).show();
Since you hide the div tag at the beginning, you need to show it later to see its contents.
var $desc = $('div'),
$dd = $('dl > dd');
$desc.add($dd).hide();
function showDescBox() {
hideDescBox();
var $data = $(this).next('dd').html();
$desc.html($data).show();
}
function hideDescBox() {
$desc.hide();
}
$('dl > dt').hover(showDescBox, hideDescBox);
http://jsfiddle.net/A3uMK/8/
精彩评论