height

CSS same height as Parent

随声附和 提交于 2019-12-24 13:09:42
问题 So I have an image that needs a hover effect; HTML <div class="data"> <img src="http://scontent-a-dfw.cdninstagram.com/hphotos-xpa1/t51.2885-15/e15/10809512_341410899374744_4010362_n.jpg"/> <div class="overlay"></div> </div> CSS .data { width: 100px; margin: auto; padding: 5px; height: auto; } img { width: 100%; } .overlay { width: 100%; height: ___?; background-color: blue; } As you can see, the height of .data is the same as the image. How can I make .overlay the same height of .data ? 回答1:

jQuery.outerHeight doesn't work when element is hidden?

不打扰是莪最后的温柔 提交于 2019-12-24 11:07:29
问题 I'm trying to find out the outer height of a element (including padding) and it doesn't seem to work. I always get 0. Is it because the element is hidden? The element is contained inside a absolute-positioned element with "auto" height, but I don't think that should be a issue, because the element is relative... 回答1: a hidden element has an outer height, <div id="aaa" style="visibility:hidden">aaa</div> <div id="bbb" style="visibility:hidden"></div> alert($("#aaa").outerHeight());// returns

Script to animate height of DIV is changing the height of DIV suddenly

寵の児 提交于 2019-12-24 10:05:10
问题 I have the following script which was working using slideUp and slideDown effects, but isn't working properly when animating the height of a DIV: $(function () { var myTimer, myDelay = 500; $('.slide, .the_menu').hover(function () { //when either a `img.menu_class` or a `.the_menu` element is hovered over, clear the timeout to hide the menu and slide the menu into view if it already isn't clearTimeout(myTimer); $('.the_menu').animate({height:'37px'},'fast', function () { $('.the_menu').stop

How to resize textarea according to content

折月煮酒 提交于 2019-12-24 07:38:17
问题 I am adding the content to a textarea programmatically as shown below (where @muse.text is the content I want to display in the textarea) $(@el).find('.context textarea').text @muse.text $(@el).find('.context textarea').elastic() However when I check the textarea, not the entire content is seen Actual content I want to display How can I programmatically set the textarea to the height of the content? 回答1: I have wriiten some code in Fiddle. This will help you in simple way HTML <div id=

Get the final height of jquery's slideToggle() before it finishes executing - without fixed heights in CSS

拈花ヽ惹草 提交于 2019-12-24 07:37:24
问题 I need a div B on my website to update dynamically according to the run time changing height of another div A . div A uses the jquery slideToggle() [on several divs inside the div A ], but div B should only be changing (at the same time) to match the current height of div A . panel_toggle1 and panel1 are contained inside div A : $(document).ready(function () { $("#panel_toggle1").click(function () { $("#panel1").slideToggle("slow", function () { var divAheight = $("#divA").height(); $("#divB"

How to set 100% height of a parent div with absolutely positioned children (not a duplicate)?

匆匆过客 提交于 2019-12-24 07:14:57
问题 Suppose an example: <!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8"> <style type="text/css"> html, body { height:100%; width:100%; padding:0; margin:0; } body { overflow:scroll; } #wrapper { background:#5f9ea0; width:500px; height:100%; min-height:100%; margin:0 auto; overflow:auto; } #content { background:#336699; width:400px; height:100%; min-height:100%; margin:0 auto; overflow-x:hidden; position:relative;} #info-block { background:#d2691e; width:300px; left:20px; position

Differences between: myView.getLayoutParams().height = screenHeight and myView.setLayoutParams(lp)?

落花浮王杯 提交于 2019-12-24 04:29:46
问题 When it comes to change the height of a layout dynamically, I usually set the desired dimensions using LayoutParams like: RelativeLayout myView = (RelativeLayout) v.findViewById(R.id.myView); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.FILL_PARENT, screenHeight); myView.setLayoutParams(lp); But there is this shorter version as well: myView.getLayoutParams().height = screenHeight; Both are working in my case, I would prefer the second version

Differences between: myView.getLayoutParams().height = screenHeight and myView.setLayoutParams(lp)?

て烟熏妆下的殇ゞ 提交于 2019-12-24 04:29:25
问题 When it comes to change the height of a layout dynamically, I usually set the desired dimensions using LayoutParams like: RelativeLayout myView = (RelativeLayout) v.findViewById(R.id.myView); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.FILL_PARENT, screenHeight); myView.setLayoutParams(lp); But there is this shorter version as well: myView.getLayoutParams().height = screenHeight; Both are working in my case, I would prefer the second version

jQuery: add elements until a particular height is reached

霸气de小男生 提交于 2019-12-24 00:58:46
问题 I have a column on the left with a few articles. This height is dynamic and changes based on the published content. I have a column on the right that is typically shorter. I'm pulling 3 large elements and then another 5 small ones and I want to fill in the right column with extra elements until it's close to the height of the column on the left. So I pull all the large elements (3) and assume that this is shorter than the left. Then I pull the other 5 with a class attached to hide them (for

iOS - WebView and string

一世执手 提交于 2019-12-24 00:41:58
问题 i have a string called htmlString that contains some informations formatted in html. I need to put these info into a webView that load the entire html string, with color and fonts. And i need to know the string height. How can i do? 回答1: You want to do something like: [_webView loadHTMLString:htmlStr baseURL:[NSURL fileURLWithPath:path]]; You can view the docs here: http://developer.apple.com/library/ios/#documentation/uikit/reference/UIWebView_Class/Reference/Reference.html This will load