开发者

Different colours per menu option (with Fade effect)

I would like to change the background colour of page each time you click a particular tab... So each time they click a tab... it would fade in the 开发者_JAVA技巧new set colour for that tab.

The tab script I use already uses jQuery.

Something so simple prob but ive been having problems with this for wayy too long, hope you guys can help me!


Here is a demo

$("#mytab1").click(function(e) {
    $("body").css({ background: "#123456" });
});

$("#mytab2").click(function(e) {
    $("body").css({ background: "#456789" });
});

If you need to interpolate the color, you'll need to include jQuery UI as well. Here is a fade demo

$("#mytab1").click(function(e) {
    $("body").animate({backgroundColor: '#123456'}, 'slow');
});

$("#mytab2").click(function(e) {
    $("body").animate({backgroundColor: '#abc456'}, 'slow');
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜