jquery iframe resize only works in firefox - javascript

I have been desperately trying to find a way to resize my iframe according to its content. I have a working script I found here but chrome still won't work. The frame does become bigger but it won't become smaller. I've tried so many codes but to no avail. (iframes are not my choice btw) I'm no expert in js and jquery so please guide me if you can. thanks

In Chrome, the body height is defined by the height of its container, there is a circular definition if you define the size of the container by the size of the iframe body. The solution that I've found is to set the position of the iframe's body as absolute.
You can see a demo here: http://webapps.so/labs/iframe/page.html

Related

Scale content of an iframe for preview

I have an iframe that previews a page on my site. It has a smaller size than the page and I would like to be able to have the content of the page to be scaled to the size of it like if it was zoomed. Is it possible? I saw some chrome extensions with similar functionality. I looked around and was not able to find a solution for this.
I was able to solve the problem through jQuery Zoomer plugin http://dev.hubspot.com/blog/bid/89755/jQuery-Zoomer-Zoom-up-your-iFrames
I'm no expert, but you can probably try using the "zoom" property.
Here

Trouble getting viewport size with overflowed images using jQuery

I've been stuck on this annoying bug for a couple hours now. I need to get the viewport of the browser window (specifically, just the height of the visible region in the browser). Looking around, I found that jQuery can do this:
$(window).height()
This value is accurate when I first load the page, but with my site I'm working on, if I resize the browser window, $(window).height() now becomes the height of the entire document (which includes the nonvisible section. I simplified my site so that it demonstrates the problem I'm running into. Make sure the images are overflowing off the page to demonstrate my issue.
Explicitly specifying the doctype fixed it
<!DOCTYPE html>

Detect Chrome browser window width and height to prevent element overflow

I'm looking for a code that either:
Prevents an element from extending beyond the edge of a window.
OR
Detects the window width or height so that the element's width/height may be set in units of px.
This code only needs to work in Google Chrome.
I've done a LOT of research and everything looks so complicated. Isn't there a simple CSS solution?
Thanks much in advance!
I had a similar problem that jQuery solved for me,
var width = jQuery(window).width();
there's also a .height() method

Javascript-loaded content not pushing height of container?

I've exhausted my understanding of CSS and JS while tackling this issue.
On this website: http://glorydayssports.net/blog/featured-game-dodging-bullets-vs-cash-paid-dodgeball
When the Disqus comments load below, they do not push down their container. This happens in Safari and Chrome, but looks just fine in Firefox and acts as I imagined it would. I contacted Disqus about it and they said that it's possible I have JavaScript somewhere on the page that is not allowing the height to expand, but I've tried disabling all the other JS except for Disqus and it still occurs.
Has anyone seen this happen before? None of the container elements have a fixed height on them.
give div#dsq-content a height: auto;. Currently it's using .clearfix's height of 1px.

jQuery .css not changing font-size correctly in Chrome

This is the closest I've seen:
Changing font-size with jQuery css() function is crashing Chrome
But it didn't help.
Other threads mentioned that it's a bug in Webkit, but those were old threads and I couldn't find the bug report on Webkit's site.
The problem is that the header has a fixed width picture background and the navigation menu needs to stay within that width. I've since given up on HTML or CSS methods of accomplishing this. If you know of any, then please do share. So I've resorted to JavaScript (jQuery). And it works reasonably well, except in Chrome. The text actually increases in size for some odd reason.
Here's the simplified code in JSFiddle:
http://jsfiddle.net/alininja/j4jD9/12/
This gist of the code is this line:
$('body').css('font-size',(content_size-1)+'px');
For FireFox and Opera, the text size decreases to fit the header width, but not in Chrome.
If I run JSFiddle in Chrome everything works, but the funny behavior shows up on the actual website. This is happening on Chrome 17.0.963.56.
Thanks in advance!
If you want presentation consistency cross browser there is more involved than just setting font-size. You are assuming other font property defaults such as font-family are the same cross browser which they are not.
Use of a css reset will help

Categories

Resources