开发者

content doesn't append to div after hover

开发者 https://www.devze.com 2023-02-11 00:48 出处:网络
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

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/

0

精彩评论

暂无评论...
验证码 换一张
取 消