0

In this question, I would like some help in iframe-page interaction. I want the Jquery of my Iframe (see: http://jsfiddle.net/9wuC4/) to run the following function:

$(document).ready(function () {
/* Script for main page*/
$.fn.changeStyle = function () {
    $(".outside").css({
        display: "none"
    });
}
/* End script for main page */
});

Or any other css, than "display: none". Here is my full example of what I have at the moment: http://jsfiddle.net/hZMm3/ If I click on the any input in the iframe, the div with class ".outside" should change in style, like "display: none".

If anyone could help me further I would be very glad.

Barrosy
  • 1,407
  • 2
  • 25
  • 56
  • This is a duplicate of your previous question. You didn't get comment's answer because you weren't notifying any user using `@username`. Answer for **non cross domain iframe** is to use `$(parent.document).find('#parentDOMElement').changeStyle()` EDIT: ok didn't checked your jsFiddle, i'll see what's going on – A. Wolff May 01 '14 at 13:37
  • It's not a duplicate since it's a different question. Thank you for your answer. – Barrosy May 01 '14 at 13:39
  • This is fixed jsFiddle, be aware of cross domain request, you need to get it work on jsFiddle to not displaying result in embeded iframe: http://jsfiddle.net/hZMm3/4/show/ BTW, $.fn.changeStyle bound method to jQuery object, not what you seem to want to use here. And still be aware of scope issue if wrapping code in ready handler or load methods – A. Wolff May 01 '14 at 13:47
  • Thanks, I was also working on something you placed in an earlier comment, which I will comment here if the result does work. – Barrosy May 01 '14 at 14:11
  • Result: Iframe display: http://jsfiddle.net/B47wF/ -> http://jsfiddle.net/t384m/ Iframe position: http://jsfiddle.net/TNB33/ -> http://jsfiddle.net/NCsc6/ Thanks for your help, this also is a way to solve it. ^^ – Barrosy May 01 '14 at 15:23

0 Answers0