如何使用jquery增加或减少div的高度 [英] How to increment or decrement height of a div using jquery
本文介绍了如何使用jquery增加或减少div的高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我尝试减少28:
var addItemForm = $('.add-item-form');
var h = addItemForm.height()-28;
var h = toString(h);
addItemForm.height(h);
但它不起作用。
推荐答案
如果你的身高是像素,你可以写:
If your height is in pixels, you can just write:
$(".add-item-form").height("-=28");
......与增量类似:
... and similarly to increment:
$(".add-item-form").height("+=28");
查看 height
了解更多信息。
Check out the documentation for height
for more information.
示例: http://jsfiddle.net/VDcLs/
这篇关于如何使用jquery增加或减少div的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文