-
AuthorPosts
-
August 24, 2015 at 7:05 pm #492445
Hi,
I using Enfold and I need that when I click in a button it’s show a Modal Popup with a code and also open a link in other tab.
It’s possible open a modal popup and also open a new tab?
Can you help me?
Thanks
Regards.August 24, 2015 at 9:46 pm #492507Hey!
You could have two links, like:
<a href='#' id='link_to_another_tab'>Link to Another Tab</a> <a href='#?iframe=true' id='link_to_modal_popup' style='display: none;'>Link to Modal PopUp</a>
And then with jQuery chain trigger them, like:
$('#link_to_another_tab').on('click', function(){ $('#link_to_modal_popup').trigger('click'); });
Cheers!
JosueFebruary 9, 2018 at 4:07 pm #910299Hi Josue.
This works well in chrome, but in firefox or safari the iframe shows up empty.
any idea of a workaround?February 9, 2018 at 4:19 pm #910304you have seen the publishing time?
August 24, 2015 at 9:46 pmFebruary 9, 2018 at 8:20 pm #910389yes, why? do you know of something particular that has changed over the last 2.5 years regarding jquery/iframe support?
let me know if you have another better approach regarding that.February 12, 2018 at 2:45 am #910874Hi,
Did you adjust the value of the href attribute with the iframe parameter? In the example above, it will display a blank page. Please create a test page so that we can inspect it.
Best regards,
IsmaelFebruary 12, 2018 at 10:06 am #910966Ok, so I found out that it works fine except when the “triggering” link points to a file.
So this works perfectly in all browsers :
<a id='triggering_link' href='#'>Click me</a> <a id='link_to_modal_popup' href='https://www.mywebsite.com/nicepage/?iframe=true'></a>
but the following only works in chrome :
<a id='triggering_link' href='https://www.mywebsite.com/fileToDownload.zip'>Click me</a> <a id='link_to_modal_popup' href='https://www.mywebsite.com/nicepage/?iframe=true'></a>
any idea why is that ?
private content : link to a page where you can test the 2 things aboveps: the jquery chain :
jQuery('#triggering_link').on('click', function(){ jQuery('#link_to_modal_popup').trigger('click'); });
February 12, 2018 at 11:52 am #911041Hi goch,
I was not able to see the page. Please check in private.
Best regards,
VictoriaFebruary 12, 2018 at 8:04 pm #911298Hi Victoria
not sure why is that. It’s in password protected mode, so you should be able to see it.
Have you entered the password? you don’t have access to the page at all?February 13, 2018 at 5:09 am #911505Hi,
I get the same problem as Victoria on my end, do you have any ip blocking active maybe?
Best regards,
RikardFebruary 13, 2018 at 8:32 am #911565not sure what’s going on.. anyway, I just made the page public, you should be able to see it now! :)
February 13, 2018 at 9:38 am #911579i noticed here on my end a code for functions.php of your child theme:
i set the trigger-class to open-popup-linkfunction popup_script() { ?> <script type="text/javascript"> jQuery(window).load(function(){ jQuery('.open-popup-link').magnificPopup({ type:'inline', midClick: true }); }); </script> <?php } add_action('wp_head', 'popup_script');
February 13, 2018 at 11:33 am #911625Hi goch,
Have you tried the solution by Guenni007?
Let us know if this helps or you need more help from us.
Best regards,
VictoriaFebruary 13, 2018 at 12:50 pm #911666hum… sorry, I don’t understand how to use Guenni’s code…
here is my current function :function trigger_popup_on_linkClick(){ ?> <script> jQuery('#triggering_link').on('click', function(){ jQuery('#link_to_modal_popup').trigger('click'); }); </script> <?php } add_action('wp_footer', 'trigger_popup_on_linkClick');
as you can see it makes reference to both my “triggering_link” (the one the user clicks), and the “link_to_modal_popup” (the one which shows up in the iframe).
But Guenni’s code only make use of 1 id (“open-popup-link”). How can I link it to my “triggering_link” ?February 13, 2018 at 3:21 pm #911714well it is a custom-class first.
I have interpreted your desire to have a popup modal window on a link
every link you can setup (in text-block or as alb element like a button) you can give a custom class to.
so if there is a link like<a class="open-popup-link" href=" … </a>
it will than open in a modal window.
the code itself comes to child-theme functions.phpi have that problem too on a flyout in which i placed a link to a film – allthough i add that ?iframe=true (or
&iframe=true
– depending if there is allready a ? ) it does not open in a popup window.February 13, 2018 at 4:06 pm #911736I could not get your script to work unfortunately. Do you have a working example somewhere?
I have interpreted your desire to have a popup modal window on a link
Yes, what I want is :
I have a link pointing to a file.
When the user clicks that link the file is downloaded, and I want to open another page in a modal window at the same time.The solution I posted above works perfectly in chrome, but not in firefox/safari.
February 14, 2018 at 2:39 am #912039Hey!
The download and the modal window are working properly on Firefox. The download is starting automatically on Chrome but on Firefox, it’s asking for a confirmation which is normal.
Cheers!
IsmaelFebruary 14, 2018 at 4:00 am #912077The download and the modal window are working properly on Firefox.
you mean it works when you click the “click me with download” link on the page I posted?
Here (on last macOS) it only works in chrome. With last firefox (58.0.2) or safari (11.0.3) (both without any plugin) the download is started and the popup is displayed, but the popup is fully black. You can’t see any content inside (cf screen recording in private data)February 15, 2018 at 2:31 am #912569Hi,
Yes, it’s working on Firefox Windows 7. It might be related to the browser settings. Do you see any error in the console after the click? Here’s how the console can be accessed.
Firefox: https://developer.mozilla.org/en-US/docs/Tools/Web_Console/Opening_the_Web_Console
Safari: https://support.apple.com/en-ph/guide/safari/use-the-safari-develop-menu-sfri20948/macBest regards,
IsmaelFebruary 15, 2018 at 9:51 am #912678– firefox:
no error, nothing is printed in the console
– safari:
I got the following error printed :
Failed to load resource: Frame load interruptedFebruary 16, 2018 at 5:03 am #913088Hi,
It seems to be a general issue on safari browser, not sure how to fix it though.
// https://github.com/eligrey/FileSaver.js/issues/215
I’m afraid you’ll have to separate the download and modal link for now.
Best regards,
IsmaelFebruary 16, 2018 at 7:47 am #913162ok. thanks for having a look. A pity there’s no way to do such a simple thing.
I guess I will open the popup only in chrome, and for the other browsers I’ll open the link in another tab.
thanksFebruary 16, 2018 at 10:47 pm #913418Hi,
Thank you for your understanding we much appreciate it.
Best regards,
Basilis -
AuthorPosts
- The topic ‘Is possible show a modal popup and also open a link ?’ is closed to new replies.