且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何通过单击div之外的按钮来更改div的内容?

更新时间:2023-10-28 21:27:28

textword_about 更改为 textWord_about [请注意, W code> textWord_about ]

There is typo in your selector. Change textword_about to textWord_about [Note the letter W in textWord_about]

修正代码 http://jsfiddle.net/LUKGt/5/ (没有您的样式表)

Fixed Code: http://jsfiddle.net/LUKGt/5/ (without your stylesheets)

strong>代码:

Code:

$('.textWord_about').hide();

$('.link').click(function() {
    $('.textWord_about').hide();
    $('.textWord_about[data-link=' + $(this).data('link') + ']').fadeIn({
        width: '200px'
    }, 300);
});​