isotropic-2022
Share
Blog
Search
Menu

Quick And Dirty Way To Toggle An Oxygen Builder Modal Based On URL Parameter

By James LePage
 on December 24, 2020
Last modified on August 9th, 2022

Quick And Dirty Way To Toggle An Oxygen Builder Modal Based On URL Parameter

By James LePage
 on December 24, 2020
Last modified on August 9th, 2022

If you need a quick and easy way to toggle and Oxygen Builder modal on what a URL contains, use the code and steps in this article.

First, here's what this code does. Say your URL contains the parameter example.com/?toggle-modal=yes. We're going to set up a simple code block that will toggle a modal to pop up if the url contains that text.

First, add a code box and button to your page. Note the buttons ID, then go to Advanced -> Layout, and hide it.

Now, go to the modal, select the trigger type "show when user clicks element", and paste in the button id.

Make a code block (anywhere on the page works), and paste this code into the JS section.

(function($) { $(document).ready(function () { if(window.location.href.indexOf("urlparam=this") > -1) { document.querySelector('#modal_toggle').click(); } }); })( jQuery );
Code language: JavaScript (javascript)

Essentially, it sees that your url contains the parameter needed to toggle the modal, and clicks the (hidden) button, triggering the modal to pop up.

This is great if you're redirecting visitors to a page, sending them from an email, or just want to toggle an Oxygen Builder modal from a URL Paramater.


isogroup-cover
Join The IsoGroup
A vibrant Facebook Group to talk about web design and the business of agency. Daily curated resources and conversations.
oxygen-course-isotropic
Oxygen Builder Course - Coming Soon
The Oxygen Builder Mastery course will bring you from beginner to professional - ACF, MetaBox & WooCommerce modules included.
Get Launch Notification & Discount
bricks-builder-course
Bricks Builder Course - Coming Soon
The Bricks Builder Mastery course will bring you up to speed on this popular builder.
Get Launch Notification & Discount

Subscribe & Share
If you liked this content, subscribe for our monthly roundup of WordPress news, website inspiration, exclusive deals and interesting articles.
Unsubscribe at any time. We do not spam and will never sell or share your email.
Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Wendy
1 year ago

Oooh... my mind is spinning with the possibilities

Article By
James LePage
Contributors/Editors
notloggedin
James LePage is the founder of Isotropic Design, a digital agency that builds WordPress websites. I read, write and design constantly!
We're looking for new authors. Explore Isotropic Jobs.
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram