I tried to search in StackOverflow and I found similar solutions for my problem but I just can't make this work.
HTML EXAMPLE:
<iframe id="iframeA">
<!-- Here i open a dialog "**divOffirstDialog**"-->
<div id="divOffirstDialog">
<iframe id="iframeB">
...(contents)...
<button onclick="openSecondDialog('divOfsecondDialog')">
<div id="divOfsecondDialog"></div>
</iframe>
</div>
</iframe>
WORKFLOW:
Open dialog divOffirstDialog in iframeA -> inside dialog open divOfsecondDialog to open the second dialog.
PROBLEM:
The second dialog opens inside the first one.
QUESTION:
How can i open the second dialog above/outside the first dialog. How can i open ouside iframeB in iframeA?
NOTE:
Both iframes are in same domain.
Related
I'm triggering Fancybox popup automatically when the page is loaded.
Inside that popup there's a HTML content with link to other page.
That link doesn't work when it's loaded with Fancybox.
Here's my code:
<div class="popup">
<div class="container">
<h4>Description text...</h4>
<a class="btn btn-green" href="/the_url_of_the_page">View more</a> //this link is not working
</div>
</div>
<script>
$(document).ready(function() {
$('.popup').fancybox({
transitionEffect : "zoom-in-out",
}).trigger('click');
});
</script>
How can I set that link to work?
I'm using Fancybox v3.1.28
First, links, buttons, etc are working perfectly fine in fancybox.
The problem in your example is caused by the fact that you have used .popup selector to initialize fancybox, but that matches element containing your link. So, your code can be translated to 'start fancybox when user clicks on element having class ".popup"'. But, your link is inside element with class name ".popup", therefore it starts fancybox.
Finally, your code does not make any sense. If you wish to immediately start fancybox, then use $.fancybox.open() method, see https://fancyapps.com/fancybox/3/docs/#api for samples
I have such problem. On my site i use 2 popup windows. On button click opened first popup. By clicking on link inside first popup opened second popup-window.
Problem: When i click on close button in second popup - at the same time, both popup windows are closed.
Goal: close only secon popup window.
I use this js-code for 2 popups:
/* Popup */
$('.open-popup-link').magnificPopup({
type:'inline',
midClick: true
});
HTML Code:
Button
<div id="first-popup" class="popup-form">
<!-- first popup content -->
Link
</div> <div id="second-popup" class="popup-form">
<!-- second popup content -->
</div>
Tell me please how to do it, thank you in advance.
I'm having trouble getting a Featherlight modal window to show content on page load.
https://github.com/noelboss/featherlight/#usage
https://jsfiddle.net/axxdy4we/
Open Featherlight DOM with Link
Open some DOM in lightbox
This link loads html content from the data-featherlight attribute
Clicking the link will load "My Content".
On Page Load
$.featherlight($('.my-content'), {});
This only loads whats between the <a> tags, "Open some DOM in lightbox".
How to call "My Content" from the data-featherlight attribute on page load?
I need to have the html inside the data-featherlight, not outside in a div.
I thought it might be something like
$('.my-content').featherlight();
$('.my-content').featherlight.current();
Call .featherlight() on your content to ensure that the modal window is configured, and then use jQuery to .click() it right after the page loads:
$('.my-content').featherlight().click()
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://noelboss.github.io/featherlight/release/featherlight.min.js"></script>
<a href="#" class="my-content" data-featherlight="<p>My Content</p>">
Open some DOM in lightbox
</a>
I have a link like this
COME HERE
I want to open the popup.html file as a jquery popup. And I cant have it inside the current page as a <div> with an id. I must have it out side the current file.
And I cant use dialog's as it reloads the current page. Any idea on how to do it?
Inside the popup.html I am using just a single header.
Or any methods through which I can avoid the page being reloaded when dialog is closed?
Use .load() to load popup.html into a placeholder (i.e <div id="PopupPH">). This placeholder can be placed either inside data-role="page or outside it, depending on jQuery Mobile version you are using.
Moreover, in popup.html, you need to change data-role=page" to data-role="popup in order to treat it as a popup not a page.
jQuery Mobile 1.4
Insert placeholder inside body tag or data-role="page" and load popup.html.
<body>
<div data-role="page">
</div>
<div id="PopupPH">
<!-- placeholder for popup -->
</div>
</body>
Or
<body>
<div data-role="page">
<div id="PopupPH">
<!-- placeholder for popup -->
</div>
</div>
</body>
Load popup.html into placeholder
$("#PopupPH").load("popup.html");
Inside popup.html popup div, add JS to create, open and remove popup once it's closed.
<div data-role="popup">
<!-- contents -->
<script>
$("[data-role=popup]").enhanceWithin().popup({
afterclose: function () {
$(this).remove();
}
}).popup("open");
</script>
</div>
jQuery Mobile 1.3 and below
Do the same as above, except for popup placeholder should be inside data-role="page", because jQM 1.3 doesn't support external popup. Also, replace .enhanceWithin() with .trigger("create").
Using the frames & popups in jQuery mobile, you can simply include an iframe inside, although dialogs are still probably your better bet. (Especially as a click outside the popup.. kills it)
<div class="hidden">
<div data-role="popup" id="externalpage">
<iframe src="http://www.bbc.com"
width="480"
height="320"
seamless>
</iframe>
</div>
</div>
<a href='#externalpage'
data-rel="popup"
data-role="button">COME HERE</a>
<script>
$(document).on("pageinit", function() {
$( "#externalpage" ).on({
popupbeforeposition: function( event, ui ) {
console.log( event.target );
}
});
});
</script>
Demo: http://jsfiddle.net/tcS8B/
jQuery Mobile Dialogs don't refresh the page I don't think, it simply masks it with a new background for focused attention.
Try
Test
In my meteor based application i am using an I frame to show some contents to the user. It is working properly. But i want to place a close button which unloads the Iframe from the template when clicked.
I tried it as in the code given below by placing a button, but I am unable to get click event on it. means button click is not working. I am working with iframes for the first time.
Is this the right way to unload an iframe?
If not then how can i unload it, or what is the best way to unload an Iframe?
<template name="preview">
<div style='display:none'>
<div id='preview' style='padding:10px; background:#fff;'>
<button id="close_content_file">Close</button>
<iframe frameborder="1" src="{{preview_url}}" align="left" width="100%" height="500px" >
</iframe>
</div>
</div>
Template.preview.events({
'click #close_content_file':function(){
console.log(" previev butoon has been clicked");
$("#preview").fadeOut();
},
});
I placed a <button></button> in the div to close or unload the Iframe. but click is not working on that button.If I place the button in the div which is hidden. The button is working there. Iframe is opening on the complete screen. means it over lays the omplete screen as bootstrap modal dialogbox.can i place a button in the Iframe itself? . help will be appreciable
There is an issue with the binding of event with the button. Use this way.
$("#close_content_file").bind("click", function() {
//console.log(" previev butoon has been clicked");
$("#preview").fadeOut();
});
I don't know which JS lib you are using, and also I'm a little confused about the
<div style='display:none'>
but I make a little modification so it works fine with jQuery ,
here is the link http://jsfiddle.net/QHxac/