Link to specific modal
-
Hi there
I am looking for something like this, as in where you’re on a homepage, linking to a specific modal, which will make you go to that page and open that modal.
https://wordpress.org/support/topic/trigger-with-url/
Could you help me with that?
The page I need help with: [log in to see the link]
-
Not 100% sure of what you are after but I think you could use the URL Content Trigger field under the Trigger options.
If you set the Show On field to Page Load you can then enter a value in the URL Content Trigger field. For example, if we enter a value of ‘modal1’ then when the page loads the code checks for ‘modal1’ anywhere in the page URL, if it finds it the modal is displayed.
So if we call the page with a URL parameter like http://testenv.local/new-url-page-load-test/?modal=modal1 the modal will be displayed. It would also be displayed if the URL was http://testenv.local/modal1/
Hope that makes sense.
Maybe I could just have had linked my old website. It’s made in Elementor – And I want something similar. If you go to this link, my review of that specific game will be opened in a modal.
That link, is made with an html code inside elementor.
https://papangames.dk/reviews/?taverntalesPerhaps something similar is possible with this plugin?
You need to set the Trigger to Image Link. With that option you can select the image you want to use and the system will open the modal when the image is clicked.
If you wanted to open a specific review on page load say the example you gave:
https://papangames.dk/reviews/?taverntales
Then do what I said before, set the Show On field to Page Load you can then enter a value in the URL Content Trigger field, in the above example enter taverntales. Then the review will be displayed when the page is loaded.
Hi again
I’m a noob.
But I’m not sure what you’re trying to make me do, is what I need.
So let me rephrase:
On the https://papangames.dk/reviews/ theres a whole bunch of different reviews.
I want to be able to (from a link on eg. Instagram or something else) to use a link, to get the page to open, and that specific modal to open up.Right now that’s possible because of a html code in the Elementor.
(i can copy it here, if needed)But since I’ve switched to Gutenberg, and found your cool plugin, I need to re-think that code.
I’m using the Image Click option and I see no where to input a “value” or “url”.
Thank you in advance.
You are correct that option does not exist under image click. But if u create a new model and make it page load then u will see the URL. Unfortunately you will have to have 2 modals for each game. One for the image click and one that opens on page load.
Oh okay I see.
In my Elementor page, I’m using this code to get it working:
<style>.swiper-slide-image{cursor: pointer;} </style> <script> 'use strict'; document.addEventListener('DOMContentLoaded', function () { var filteredImages = document.querySelectorAll('.swiper-slide'); //Edit the links HERE var links = [ 'https://papangames.dk/reviews/?taverntales', ]; var _loope = function _loope(i) { filteredImages[i].addEventListener('click', function () { let linkid = filteredImages[i].getAttribute("data-swiper-slide-index"); location = links[linkid]; }); } for (var i = 0; i < filteredImages.length; i++) { _loope(i); } });And
<script> document.addEventListener('DOMContentLoaded', function() { jQuery(function($){ let desktoptitles = $('.premium-modal-trigger-img'); let strings = [ '?taverntales', ]; strings.forEach( (string,i) => { if (window.location.href.indexOf(string) > -1) { desktoptitles.eq(i).click(); $('html, body').animate({ scrollTop: desktoptitles.eq(0).offset().top - 100 },'slow'); } } ); }); }); </script>Would something like this be possible to do too?
-
This reply was modified 3 years, 7 months ago by
papangames.
Not totally sure what that code does, but the functionality on the page you provided can be replicated using the block. There is no API for the block, but you can provide the same functionality using a mix of image triggers, and load page triggers (specifying the unique URL content).
-
This reply was modified 3 years, 7 months ago by
The topic ‘Link to specific modal’ is closed to new replies.