Popup on page load

Permalink Browser Info Environment
Great add on! Is there a way to make popups automatically display on page load?
I've tried triggering a click with jquery but it's not working.

Any help appreciated.

Type: Ticket
Status: Resolved
soupmedia
View Replies:
mnakalay replied on at Permalink Reply
mnakalay
Hello,
It should work, really. Could you show me the code you used and if possible the page where the popup is, so I can run some tests?
soupmedia replied on at Permalink Reply
soupmedia
Thanks for getting back to me. I ended up using a different add-on (Stack Popover I think from memory) as I was under some time pressure.

I have another site in progress that I'll use this licence of Buttons Pro for. It's such a great add-on.

For future reference, how would you call a popover on pageload? I had a separate html block with some javascript that was trying to target the button link on page ready and hitting it with a click() but it wasn't firing. Clunky I know, but this was an old site that I hadn't touched on for years.

I also tried wrapping it in a custom class and getting to it that way to no avail.

I had a bit of a dig through the controller and created a custom view but couldn't see where the magnificPopup code was being inserted. My initial thought was to just call the open method on that on pageload.

In any case, my client wanted to be able to add popups themselves in future and the other add on was a bit simpler.
mnakalay replied on at Permalink Reply
mnakalay
Personally, I would have done what you did and try to trigger a click on the button.

I would have created a template for the block, copying the code from the normal block's view. I would have put my JS code in the template right after the button code.

It might be better to select a link element instead of a button element for the button.

This is untested, though, I just can't imagine why it wouldn't work.

If you look through the block's view.php I left comments explaining how you can customize the button output from code. One thing you can do, as explained in my comments, is grab the full button markup and modify it before outputting it to the page. You could do that and modify it as you please but frankly it seems overkill for your purpose.
soupmedia replied on at Permalink Reply
soupmedia
Thanks. Yeah, I did make a new template for the block and started messing around with it but my client needed something easier to manage going forward. Your add on was the first one that came up when I searched C5 Popup :-)

I appreciate the support though. Thanks again.

concrete5 Environment Information

C5 8.5.2.1

Browser User-Agent String

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.