开发者

jquery change id on hover

开发者 https://www.devze.com 2023-01-28 03:17 出处:网络
$(\'#klik\').hover(function() { $(\'#font1\').animate({\"color\":\"#efbe5c\",\"font-size\":\"52pt\"}, \'fast\');开发者_StackOverflow中文版
$('#klik').hover(function() {
    $('#font1').animate({"color":"#efbe5c","font-size":"52pt"}, 'fast');开发者_StackOverflow中文版
}, function() {
    $('#font1').animate({"color":"#e8a010","font-size":"48pt"}, 'fast');
});

how can i change the code, so instead of the values there #font1 will change to #font2 ?


You can do it

$('#font1').attr("id",newId);

Let me know if that solved your issue!


Here is an example of using css to change the color and the font size. You will lose the transition effects that the animate gives you...I don't know if that is important.

http://jsbin.com/urido4/3/edit

Bob

0

精彩评论

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