height

How to get Body element height dynamically using JQuery

心不动则不痛 提交于 2019-12-05 01:59:56
问题 I need to get the body element height and width, when i resize the browser windows Please help me to solve this problem using JQuery 回答1: Use the resize event on the window object: $(window).resize(function(){ var width = $(document).width(), // or $(window).width() height = $(document).height(); // or $(window).height() }); 来源: https://stackoverflow.com/questions/1298026/how-to-get-body-element-height-dynamically-using-jquery

how to overwrite css height set by jquery/javascript?

别说谁变了你拦得住时间么 提交于 2019-12-05 01:52:51
I have this: var setHeight = $(this).outerHeight(); // returns e.g. 687 $("#someElement").css({'height': $setHeight+"px !important" }); // I want to override this jquery-set height I'm not sure this is the right way... probably not, since it's not working. Thanks for helping out! setHeight , not $setHeight . and the !important is unneeded. Your variable name doesn't have a leading $ . Also, the !important flag will cause this not to work in Firefox, however as you're applying this style directly to the element, you shouldn't need it. $("#someElement").css({ 'height': setHeight + "px" }); Also

what is the jQuery outerHeight() equivalent in YUI

萝らか妹 提交于 2019-12-05 01:43:40
In jQuery, I can very easily get the current computed height for an element that includes padding, border, and optionally margin by using outerHeight() ... // returns height of element + border + padding + margin $('.my-element').outerHeight(true); How would I do this in YUI? I'm currently using version 2.8.1 . Similar to this question , I can always do getComputedStyle() for height, border, padding, and margin, but that is a lot of manual labor which includes parsing the return values and grabbing the correct values that are needed and doing the math myself. Isn't there some equivalent

iOS: Resize UIWebView after didFinishLoad (content should fit without scrolling)

梦想的初衷 提交于 2019-12-05 01:31:55
问题 I am absolutely unable to resize my UIWebView . My UIWebView is declared in .h and in connected in IB. The height in IB is 110. But the height of my text is about 1500. Now I'd like to change the height so the full text is readable without scrolling. What code does resize my UIWebView in webViewDidFinishLoad ? Can't find ANYTHING that works. 回答1: The UIScrollView property is available for UIWebView starting in iOS 5. You can use that to resize your view by implementing the

jQuery outer height is zero?

巧了我就是萌 提交于 2019-12-05 01:27:41
Why is the height of my search form 0? It's at least 20px high. jQuery(function($) { // Document ready var s_height = $("#search_form").outerHeight(); // Height of searchform alert(s_height) // 0 Blair McMillan With jQuery you can only get the height of an element if it is visible. So make sure that it is visible at the time that your JS runs, or use one of the several workarounds if you need it to be hidden at the time. As you mentioned in your comments, the div was hidden and then fading in. If search_form contains floats, try overflow:hidden; on it. If it contains images, try $(window).load

Set Video height in HTML5

情到浓时终转凉″ 提交于 2019-12-05 00:40:29
May be its a simple question but it's really driving me crazy. I just want to set the height and width of the HTML5 video. I am using this code: <video controls="controls" width="1000" id="video"> <source src="sintel-trailer.ogv" type='video/ogg; codecs="theora, vorbis"'> <source src="sintel-trailer.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'> </video> Result: If I add height attribute <video controls="controls" width="1000" height="300" id="video"> <source src="sintel-trailer.ogv" type='video/ogg; codecs="theora, vorbis"'> <source src="sintel-trailer.mp4" type='video/mp4; codecs=

HTML div elements not taking the height of their parent, even though the parent has nonzero height

感情迁移 提交于 2019-12-04 23:42:10
问题 I have a fairly simple problem. I have a container div with three children - two divs and a table. The following is the CSS: #container { overflow: auto; } #child1 { float: left; width: 50px; height: 100%; } #table1 { float: left; } #child2 { float: left; width: 50px; height: 100%; } The HTML is very simple as well <div id='container'> <div id='child1'></div> <table id='table1'> <tbody></tbody> </table> <div id='child2'></div> </div> The table has some content that sets its height. When the

<li> will not take 100% height of the parent <ul>

孤者浪人 提交于 2019-12-04 23:33:33
I have a <ul> with several <li> items in it all in a single row. The <li> has a nested <span> and an <img> . The <img> height is all the same across all items. But the <span> items contain text which can span on a single line or two lines (depends on text). I have tried appying display:block , float:left , height:100% , and few other suggestions I found, but the shorter <li> items will not take the same height as the taller <li> items. So I am left with a space below the shorter <li> items. Anyone has any suggestions on this? Joe_G In this case, when you set height:100% it isn't inheriting any

The height of the code-mirror block are not the same in Chrome and Safari

倖福魔咒の 提交于 2019-12-04 23:18:31
I want to make a layout that satisfies the following conditions: 1) it has a block on the top whose height is up to its content 2) below it has a code-mirror and a block side by side, which fill in exactly the rest of the page in terms of height . I have made a plunker here. The problem is it works well in Chrome 57.0.2987.133 , whereas it does NOT work well in Safari 10.1 : the height of the code-mirror is NOT enough; it shows only 76 lines of the code rather than the correct 80 lines. Does anyone know how to fix this? <style> .rb { display: flex; flex-direction: column; height: 100%; } .rb

Animate cell height change in UITableView [duplicate]

僤鯓⒐⒋嵵緔 提交于 2019-12-04 23:11:35
This question already has answers here : Closed 7 years ago . Possible Duplicate: Can you animate a height change on a UITableViewCell when selected? I'd like to change the height of a UITableViewCell when it gets selected. I'm able to do this by defining - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath and calling the tableview's reloadData when the cell gets selected, but I'd like to have the change be animated. Any suggestions on how to go about this? Try calling reloadData in an animation block after you have set parameters that will force a