You need to be logged in to post in the forum - Log In

An active JCE Pro Subscription is required to post in the forum - Buy a Subscription

  1. wires
  2. MediaBox
  3. Monday, 02 November 2020
I am using jQuery to populate content in an article. Several items in the dynamically added content include links that should be opened using the JCE Mediabox plugin. The markup of the links matches a popup link added via the JCE editor plugin.

<a href="https://www.iframeUrlHere.com" type="iframe" class="jcepopup" data-mediabox="1">View popup</a>


However, the dynamic links only open the link in the full window, not in a popup. My guess is, there is a script that searches the DOM on page load for elements with the class "jcepopup" to add listeners for each item. My content, loaded after the initial page load, is not included with that search.

Can I manually call for the mediabox script to be re-run after the dynamic content is loaded, or is there another way to initiate the popup for the dynamic content links?

J! 3.9.22, JCE 2.9.1

Thanks,
Joel
Accepted Answer Pending Moderation
After doing some more looking at the scripts loaded on my site, I found the JCEMediaBox.init() function call with a ton of parameters in a js object. I have added the JCEMediaBox.init() to my dynamic content loading script without the parameters. It seems to be working as I would expect. The dynamic links now display in popups.

Is this method going to cause problems? Is there a better way to do this or is this the way to go?
  1. more than a month ago
  2. MediaBox
  3. # 1
Accepted Answer Pending Moderation
Can I manually call for the mediabox script to be re-run after the dynamic content is loaded, or is there another way to initiate the popup for the dynamic content links?


Use

WfMediabox.create();


You can also specify exactly which items to create as popups, eg:

WfMediabox.create($('a[href]');
Just because you're not paranoid doesn't mean everybody isn't out to get you.
  1. more than a month ago
  2. MediaBox
  3. # 2
  • Page :
  • 1


There are no replies made for this post yet.
Be one of the first to reply to this post!