jquery get height of iframe content when loaded

ok I finally found a good solution: $(‘iframe’).load(function() { this.style.height = this.contentWindow.document.body.offsetHeight + ‘px’; }); Because some browsers (older Safari and Opera) report onload completed before CSS renders you need to set a micro Timeout and blank out and reassign the iframe’s src. $(‘iframe’).load(function() { setTimeout(iResize, 50); // Safari and Opera need a kick-start. var … Read more

Get the visible height of a div with jQuery

Calculate the amount of px an element (height) is in viewport Fiddle demo This tiny function will return the amount of px an element is visible in the (vertical) Viewport: function inViewport($el) { var elH = $el.outerHeight(), H = $(window).height(), r = $el[0].getBoundingClientRect(), t=r.top, b=r.bottom; return Math.max(0, t>0? Math.min(elH, H-t) : Math.min(b, H)); } Use … Read more

Height 100% on flexbox column child [duplicate]

TL;DR: Set .flex to display:flex, and get rid of the height:100% on .flex-child. You can see the modified CodePen here. Why it works: I learned from this similar question that, according to the flexbox spec, an align-self:stretch value (the default for a flex’d element) changes only the used value of an element’s cross-size property (in … Read more

Get height of div with no height set in css

jQuery .height will return you the height of the element. It doesn’t need CSS definition as it determines the computed height. DEMO You can use .height(), .innerHeight() or outerHeight() based on what you need. .height() – returns the height of element excludes padding, border and margin. .innerHeight() – returns the height of element includes padding … Read more

jquery $(window).width() and $(window).height() return different values when viewport has not been resized

I think what you’re seeing is the hiding and showing of scrollbars. Here’s a quick demo showing the width change. As an aside: do you need to poll constantly? You might be able to optimize your code to run on the resize event, like this: $(window).resize(function() { //update stuff });

Adjust UILabel height to text

I’ve just put this in a playground and it works for me. Updated for Swift 4.0 import UIKit func heightForView(text:String, font:UIFont, width:CGFloat) -> CGFloat{ let label:UILabel = UILabel(frame: CGRectMake(0, 0, width, CGFloat.greatestFiniteMagnitude)) label.numberOfLines = 0 label.lineBreakMode = NSLineBreakMode.byWordWrapping label.font = font label.text = text label.sizeToFit() return label.frame.height } let font = UIFont(name: “Helvetica”, size: 20.0) … Read more

How to determine height of UICollectionView with FlowLayout

Whoa! For some reason, after hours of research, I now found a pretty easy answer to my question: I was completely searching in the wrong place, digging through all the documentation I could find on UICollectionView. The simple and easy solution lies in the underlying layout: Just call collectionViewContentSize on your myCollectionView.collectionViewLayout property and you … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)