我使用这个相对简单的代码:
var height = help ? 'minus' : 'plus';
var prop = $('#properties');
if(height == 'minus'){
prop.height(prop.height() -= 206);
} else {
prop.height(prop.height() += 206);
}
Run Code Online (Sandbox Code Playgroud)
在添加/减少的两行上都失败了!有任何想法吗?
该-=操作相当于operand = operand - value而你的情况会是什么样子
prop.height() = prop.height() - 206;
Run Code Online (Sandbox Code Playgroud)
这显然会失败.您只需要使用减号运算符即可完成该任务.
prop.height(prop.height() - 206);
Run Code Online (Sandbox Code Playgroud)
会做的.
| 归档时间: |
|
| 查看次数: |
13940 次 |
| 最近记录: |