8 Replies - 1729 Views - Last Post: 14 August 2014 - 02:28 PM

#1 Herman de Vries   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 05-August 14

Alternative code for clicking div in parent window? (ad-blocker error)

Posted 05 August 2014 - 03:41 AM

I want my Iframe to be able to click on a Div in the parent window
I used the following code:

Symbol.bindElementAction(compId,symbolName,"${_RectangleCopy3}","click",function(sym,e){window.parent.$('#u184').trigger('click');});



( "_RectangleCopy3" will click on "#u184" in the parent window)
It works fine, the problem is; in some browsers the ad-blocker blocks this code, and many people use an ad-blocker, so I was looking for an alternative.
(could be anything, jquery, java, anything)
Anyone have an Idea?
Thanks in advance...

Is This A Good Question/Topic? 0
  • +

Replies To: Alternative code for clicking div in parent window? (ad-blocker error)

#2 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4303
  • View blog
  • Posts: 13,677
  • Joined: 08-June 10

Re: Alternative code for clicking div in parent window? (ad-blocker error)

Posted 05 August 2014 - 04:46 AM

Quote

It works fine, the problem is; in some browsers the ad-blocker blocks this code, and many people use an ad-blocker, so I was looking for an alternative.

don’t trigger the click (because that’s what ad-blockers are supposed to prevent), call the handler directly.
Was This Post Helpful? 1
  • +
  • -

#3 squibby   User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 91
  • Joined: 21-January 12

Re: Alternative code for clicking div in parent window? (ad-blocker error)

Posted 05 August 2014 - 11:44 AM

Has that code been generated by edge animate? If so why is it in an Iframe, are you not able to embed it within the site without an iframe?
Was This Post Helpful? 0
  • +
  • -

#4 Herman de Vries   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 05-August 14

Re: Alternative code for clicking div in parent window? (ad-blocker error)

Posted 06 August 2014 - 06:05 PM

Thanks for your quick response!,

Yes; The first part is, but I can not embed it into the site with a oam file, because of several (mainly layout) reasons, but even if I would, I would have to work with clicking a link in a "parent" window (I tried it). Is there some other way I could embed a edge animate page into the main site without layout issues?

This post has been edited by Dormilich: 07 August 2014 - 02:53 AM
Reason for edit:: removed previous quote

Was This Post Helpful? 0
  • +
  • -

#5 Herman de Vries   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 05-August 14

Re: Alternative code for clicking div in parent window? (ad-blocker error)

Posted 06 August 2014 - 06:26 PM

View PostDormilich, on 05 August 2014 - 04:46 AM, said:

Quote

It works fine, the problem is; in some browsers the ad-blocker blocks this code, and many people use an ad-blocker, so I was looking for an alternative.

don’t trigger the click (because that’s what ad-blockers are supposed to prevent), call the handler directly.


Thanks for your quick response!
How would I do that?
The event has to happen in the parent window. Right now the parent window has to scroll to a certain point on its page, the point is, the functionality of the button/div (that gets clicked) might change over time.(different links, functions, etc.)

Is there a script that will let the parent window scrol to a certain point? (>Ad-blocker safe< ;)
For now, that might help a lot!
Was This Post Helpful? 0
  • +
  • -

#6 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4303
  • View blog
  • Posts: 13,677
  • Joined: 08-June 10

Re: Alternative code for clicking div in parent window? (ad-blocker error)

Posted 07 August 2014 - 02:54 AM

Quote

How would I do that?

call the function you added to the event.
Was This Post Helpful? 0
  • +
  • -

#7 squibby   User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 91
  • Joined: 21-January 12

Re: Alternative code for clicking div in parent window? (ad-blocker error)

Posted 08 August 2014 - 05:01 AM

Could you assign an ID to your button and then have a function which performs what you need to do?

something like:

<button id = "yourButton"></button>


$('#yourButton').click(function(){
   // do something
 alert('it works');


});


This post has been edited by squibby: 08 August 2014 - 05:03 AM

Was This Post Helpful? 0
  • +
  • -

#8 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4303
  • View blog
  • Posts: 13,677
  • Joined: 08-June 10

Re: Alternative code for clicking div in parent window? (ad-blocker error)

Posted 08 August 2014 - 05:59 AM

Quote

Could you assign an ID to your button

the point is that you click somewhere in an iframe, not in the document you want the action to happen.
Was This Post Helpful? 0
  • +
  • -

#9 squibby   User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 91
  • Joined: 21-January 12

Re: Alternative code for clicking div in parent window? (ad-blocker error)

Posted 14 August 2014 - 02:28 PM

I have come across this issue today and was able to trigger events in the parent window from the Iframe. The parent container was an edge animate project and the Iframe was not.

I attached an onclick event in iframe. Something like the following:

<div onclick = "parent.trigger();" id = "mybutton"></div>



Then in your parent window (in my case edge animate project) I included a function called trigger() which is invoked when the div in the Iframe is clicked.

You can get this function to do whatever you like. Hope that helps out a bit. Make sure you use .parent before the function in the Iframe.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1