anchors and iframes? - iframe

I have an HTML document with an iframe in it. Now, if you click a certain button/link in the iframe, I want the parent document to scroll back to the top.
I'm not sure how to make that work. When I put an anchor at the top of the parent document, and have the button do something like window.parent.location = '#anchorname';, then the browser opens the iframe document itself, having the parent one vanish.

First of all, I suggest the usage of JQuery scrollTop (see here) to scroll on top. This is not enough, however, you need to call your function from the page in the iFrame, so, supposing that your function which scrolls your document is called 'foo', you can call your function from the page in the iFrame this way:
window.parent.foo();
Hope this helps.

Related

How to make elements with high z-index allow click events at elements below?

I'm developing a chrome extension. It is basically a toolbar standing at the upper part of the visible screen, added to the page as an Iframe.
My problem is that I set it a high z-index to make sure the bar appears; and then the elements below it (below the Iframe) gets not clickable (lets say I got a piece of the iFrame that is transparent, what allows the user to see the elements below it). Other Stack Overflow questions doesn't address my problem, since they suppose I have control at both the upper and the lesser elements, and I don't have at the lesser one.
If only certain parts of the iframe should let the clicks pass through then in the iframe's onclick handler send a message to the content script of the page via postMessage with the click point coordinates and in the content script's document.addEventListener for that message use querySelectorAll(':hover') or document.elementFromPoint while temporarily hiding the iframe to find the clicked element and then dispatch a new click event to that element via dispatchEvent (plus the iframe's top-left corner offset in the original document).
You can do this simply by using CSS
pointer-events: none
height: 0px;
overflow: visible;

DevExpress popup does not overflow outside of iframe

I included a FilterControl inside an iframe popup. When I open the column selector (or any other DevExpress combobox) the popup does not 'overflow' outside of the frame. What I want is to be able to see the contents of the popup outside of the frame, instead of having to scroll down to see the whole option list.
Basically this is how it looks like (obviously not actual code):
<iframe>
<dx:ASPxFilterControl/>
</iframe>
Is this possible? All of our popups in the site are created in the same way and we wouldn't want to use different popups just because of this.
It's impossible. This is how iframes work. Check the following threads:
How to show HTML element outside iframe boundaries
Is there a way to have content from an IFRAME overflow onto the parent frame?

Fancybox for Wordpress - dynamically resize width based on content

I'm using Fancybox for Wordpress to display a form.
Within the fancybox is a div with id "popup1", which contains the form.
When the user submits the form, #popup1 disappears, and #popup2 appears. div#popup2 just has a little "Thank you" message that is very short.
The height of the fancybox window automatically resizes to fit the height of the content when I switch from popup1 to popup2, but I want the WIDTH of fancybox window to shrink also. How can I do that?
Thanks in advance!
You have several handlers to flip from one pop-up to another like
$("#popup4-BA").slideDown("slow");
Try adding the fancybox (v1.3.4) method $.fancybox.resize() after completing the animation like
$("#popup4-BA").slideDown("slow", function(){
$.fancybox.resize();
});
... you may need to do this in every handler.
Some Notes:
you first pop-up has a fixed width so you may need to try removing it and set the css width property to auto.
since you are using fancybox v1.3.4 with inline content, you need to be aware of this BUG and workaround.

jqModal iframe issue

I have a asp.net page (page1.aspx), inside that I have a iframe, Inside the iframe I am loading another page(page2.aspx). Inside that page(page2.aspx) I have a button. When I click on that button jqModal pops up. It comes up covering the iframe which is in page2.aspx. How can i make the jqModal div to allocate parent page(page1.aspx) full space.
Presumably you have to pass through the identifier for the parent page all the way through to the jqModal div and use that as the anchor point.

Accessing document.body of parent window from within IFrame

I have a script in an iframe that listens for movements of the mouse from document.body as follows:
$(document.body).addEvent('mousemove',this.refresh.bind(this));
This works fine from within the IFrame, but I want to also track that the mouse is being moved outside of the Iframe. Anyway to do this? I am using MooTools.
The script in your iframe may or may not be allowed access to the parent. If the parent is in the same domain, it will.
In that case, you should be able to use something like this:
$(parent.document.body).addEvent('mousemove',this.refresh.bind(this));
This would capture any mouse movement within the parent window. "parent" is a property of "window" that is a reference to the "window" object of the parent iframe.

Resources