开发者

Jquery - BBC +/- buttons

as my boss loves the bbc site (www.bbc.com), does anyone have any suggestions for creating the functionality for controlling how many items are in the list using the plus and minus buttons? When clicking plus it will add more items, when clic开发者_如何学Pythonking minus it wil remove the bottom item.

It looks like this is done using Jquery, anyone have any suggestions?

Thanks


BBC loads all the items and just marks some of them as hidden using a .hide CSS class. It's not very sophisticated. So your jQuery will go something like:

Plus

$("#myDiv li.hide:first").removeClass("hide");

Minus

$("#myDiv li:not(.hide):last").addClass("hide");

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜