好吧,即使选定的ID具有选定的类,我也会尝试将某些内容设置为不同的高度.我有以下代码.
function myfunction() {
if ($('#homebutton').hasClass("active"));
{
$('#content').animate({height: "240px",opacity: 1}, 100 , hideLoader());
}
if ($('#showbutton').hasClass("active"));
{
$('#content').animate({height: "79px",opacity: 1}, 200 , hideLoader());
}
if ($('#aboutbutton').hasClass("active"));
{
$('#content').animate({height: "527px",opacity: 1}, 300 , hideLoader());}
if ($('#contactbutton').hasClass("active"));
{
$('#content').animate({height: "1040px",opacity: 1}, 400 , hideLoader());
}
}
Run Code Online (Sandbox Code Playgroud)
无论我点击什么,它都会在彼此之后将动画链接起来,结果是1040px高,我做错了什么?
试着改变它
{if ($('#homebutton').hasClass("active"));
$('#content').animate({height: "240px",opacity: 1}, 100 , hideLoader());
}
Run Code Online (Sandbox Code Playgroud)
绝对没有效果