So sánh iframe với modal popup

I'm working on a Facebook campaign that is presented in a tab. Facebook.com loads the campaign within an iFrame. The campaign is build using Bootstrap 3.

I'd like to position a modal horizontally and vertically centered in respect to the visible viewport of the iFrame to make sure the user sees the modal. However the height of the iFrame is constantly reset by Facebook using a JS script called AutoGrow(). In that way the content within the iFrame can reload with AJAX and so removes the possibility of a double scrollbar (one for Facebook.com, one for the iFrame).

In order to get the modal which is in the iFrame centered to the user, the script:

  • needs to know if the iFrame is visible to the screen, if so
  • the height of the visible part of the iFrame

I found a code snippet that gives an idea, however this code uses the total height of the document, not the visible part of an iFrame. http://codepen.io/shshaw/pen/gEiDt

I wonder if vertically centering within an iFrame's viewport can be done.

1 Answer

So sánh iframe với modal popup

Allright, found Facebook provides you with information about the parent frame, which makes it possible to center a modal within the Facebook iFrame: https://developers.facebook.com/docs/reference/javascript/FB.Canvas.getPageInfo

For anyone who is wrestling with the same issue later. Example code below positions the Bootstrap3 Modal vertically centered relative to the visible viewport of the iFrame. Change the $myDialog variable to select the right modal in your HTML.

I am using iframe in my application to render the content part on click of the menu. Please find my code used to include iframe below

On showing a modal popup panel, it is graying out and disabling the background of iframe part only (higlighted in red), not the other parts in the entire page. Please find the attached image.

Want to keep visitors on your site while showing them external content? Check out our iFrame Preview Popup Modal Webflow Cloneable! Created by Relume, this cloneable lets you easily create a popup modal of an iframe URL, perfect for portfolios or pages where users don't need to navigate away. With this powerful tool, you can keep users engaged and on your site while allowing them to preview external projects. Try it today and elevate your website's user experience!

So sánh iframe với modal popup

Here's a way of adding custom popup modals for video and content to your Webflow site. These custom content modals utilize custom code to disable scrolling when the pop up modal window is open. This helps prevent user confusion and scrolling of the site when these modal windows are open. For the video popup additional jQuery code is utilized to stop the video from running in the background when the window has been closed.

So sánh iframe với modal popup

2

Twenty prebuilt CSS button hover effects to allow you to easily add button hover effects without complicated Webflow interactions. These include a number of unique effects such as marquee text on hover, fade in and fade out, 3D expanding effects, chat widget buttons, rotating and much more. You can add these to your Webflow site by copying the HTML embed with the relevant CSS scripts for the button effects that you want. Add the custom css class to your buttons and you'll immediately be able to view the button effects within Webflow designer. This makes for easy, and lightweight buttons that provide fun effects without the headache of interactions or complicated hover states.

So sánh iframe với modal popup

A copy and paste GDPR compliant cookie consent widget. This Webflow cloneable features a pre-made and GDPR compliant cookie consent widget perfect for your Webflow site. This method stops all scripts from loading, requires no javascript editing and utilizes Webflow's data attributes and works with Webflow interactions. You can create multiple options for the levels of cookie consents and this cloneable comes with 5 different variations of the cookie consent, one that utilizes Webflow interactions. This is a complete solution to allow you to properly validate your users cookie experience based on GDPR requirements.

So sánh iframe với modal popup

Here's a way to add TikTok videos in a slider with Finsweet client first naming conventions driven by Webflow native CMS. Adding videos could be automated with Make/Integromat or Zapier with the creation of new items in the slider from this collection. This uses the CMS to drive the videos and uses Client-first CSS classes.

So sánh iframe với modal popup

3

Pop up contact form modal interaction for Webflow. A clean modal window appears with a contact form when clicking on the contact button. This contact modal form features all the native Webflow interactions required for a modal window in a fully responsive design.

So sánh iframe với modal popup

1

Add an infinite horizontal marquee to your Webflow site using only HTML & CSS. Building infinite marquees with Webflow interactions can be difficult and confusing. This solution allows you to easily add a horizontal marquee to your Webflow site using HTML embeds or Webflow's custom code. The infinite marquee is lightweight and allows you to customize the direction, as well as the speed at which the marquee is displayed on your site. Skip the confusing calculations typically required for native Webflow interactions and add an infinite Webflow horizontal marquee to your site in seconds.

So sánh iframe với modal popup

1

Here's a way of creating structured CMS pop up modal for your CMS items in Webflow.

So sánh iframe với modal popup

A GDPR compliant cookie consent modal window for Webflow. This cookie consent compliant GDPR Webflow cloneable uses the fs-cc attributes to your scripts and can easily be implemented on any Webflow site. Simply clone the project, add the custom cookie consent script found in the custom code settings in the projects settings and modify them according to your requirements. The cloneable includes a premade cookie consent modal window with the ability to customize cookie settings and clearing all cookies.

Real-time sorting by

So sánh iframe với modal popup

So sánh iframe với modal popup

An animated timeline scrolling effect perfect for about pages, historical pages and many others. As the user scrolls down the page a fun native interaction is applied that allows users to visit historical timelines with a unique Webflow interaction. The current date and item that is in view increases brightness while others out of view are faded out. The user can scroll down the page and have historical information provided in a unique and interactive fashion. This interaction uses while scrolling in view and while page is scrolling page trigger interactions.

So sánh iframe với modal popup

The starter style guide project for the Relume Library. This project contains a style guide with the necessary pre-built classes. There are no pages, no layouts, and nothing to delete. This simply allows you to get up and running with Relume, easily. The Relume Library uses Finsweet's client-first Webflow style system. You can find the prebuilt page under Drafts/Style Guide. The styleguide comes with Headings (H1-H6), heading classes (heading-xxlarge), Paragraphs, Links, Block Quotes, Lists, text sizes, text weights, letter spacing, line heights, text styles (using custom Global CSS), text alignment, rich text, colors, background colors, premade shadows, UI elements, buttons (with icons, alternates, icon locations), form elements, icons, image wrappers.

So sánh iframe với modal popup

Create a popup iframe modal in Webflow easily with this cloneable. This cloneable allows you to you easily create a popup modal of an iframe URL, perfect for portfolios or pages in which users do not need to navigate to another page. Keep users engaged and on your site while allowing them to preview portfolio sites and other similar projects.

So sánh iframe với modal popup

Two examples of animated Macbook and Apple animated mockups that are perfect for your Webflow site. Two variations of the Macbook coming into view and then opening as the user scrolls down the page. This uses a combination of Webflow interactions and Lottie files, with videos as the backgrounds for the mockup computers. These animated Mac mockups are perfect for portfolios, demo videos, demo GIFs and much more. A great example of how a simple Webflow interaction combined with Lottie files allows for a truly unique and dynamic animation in Webflow.