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

Support is currently Online

Official support hours
Monday to Friday
09:00 - 17:00 Europe/London (BST)

#105765 Popup links in dynamic content

Posted in ‘Mediabox’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Latest post by Ryan on Tuesday, 03 November 2020 12:23 GMT

wires
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

wires
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?

Ryan
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]');

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.