Updating properties on an already open Featherlight iframe in Featherlight.js

When initiating a new featherlight iframe, my code looks like this:

$.featherlight({
    iframe: href,
    iframeWidth: $(window).width(),
    iframeHeight: $(window).height(),
    openSpeed: 0,
    beforeClose: myBeforeCloseCallback
});

Is there a way to later modify the properties of the already opened featherlight window, such as beforeClose, and load a new URL? I assume it involves using $.featherlight.current();, but what steps come after that?

Answer №1

Adding that feature would definitely be beneficial. At the moment, it is not available.

If you want to try it out, you can use

$.featherlight.current().setContent($('<b>example</b>'))
, as an example.

To see how we implement this in the gallery, check out this link

A basic code snippet that could work might resemble this: (not tested)

var fl = $.featherlight.current();
fl.iframe = "new url";
var $newContent = ;
$.when(fl.getContent(), function($content) {
  fl.setContent($content)
});

Feel free to submit an issue or, even better, a PR...

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

An issue has occurred: Angular2 is reporting that Observable_1.Observable.defer is not recognized as a

Recently, I made the transition of my Angular app from version 4 to 6. Here is a peek at my package details: Package.json file: { "version": "0.10.50", "license": "MIT", "angular-cli": {}, ... Upon running npm run start, an error popped up in th ...

Javascript Snake: I am having trouble making my snake's tail grow longer

I've created a snake game that is almost fully functional. The issue I'm facing is that when the snake eats food, the food changes location but the tail of the snake doesn't grow in size. I suspect that my understanding of arrays might be la ...

Activate the audio playback when a marker is detected using A-frame and Ar.js, playing the audio only once

I'm having trouble playing a sound only once when a marker is detected using A-frame and AR.JS libraries. Here's the code I've tried, but the sound keeps playing indefinitely: <a-scene embedded arjs='sourceType: webcam; debugUIEnabl ...

Guide to rendering JavaScript with pug/jade

Let's say I pass the user variable to this Pug file and I'd like to execute some JavaScript code after the DOM has finished loading. script. document.addEventListener("DOMContentLoaded", function(event) { console.log(#{user.name});/ ...

Sending MVC3 model information as JSON to a JavaScript block

My challenge is to correctly pass my MVC3 model into a script block on the client side. This is the approach I'm taking in my Razor view: <script type="text/javascript"> var items = @( Json.Encode(Model) ); </script> The "Model" in t ...

Asynchronous operations and recursive functions in the world of Node.js

When working with express and mongoose, I frequently find myself needing to perform batch operations on collections. However, the typical approach involves callbacks in nodejs concurrency coding, which can be cumbersome. // given a collection C var i = 0 ...

What is the best way to shift an icon to the right?

How can I position the icon to the right? <Grid container justify="space-between" border="1px"> <Typography variant="h6" className="locationTitle" display="block"> example text ...

Executing Javascript prior to Gatsby page load

Currently, I am in the process of converting an HTML template using Bootstrap 5 into a Gatsby template. While the CSS and pages are functioning as expected, I have encountered an issue with the inclusion of a main.js file within the HTML template that need ...

What is the best way to exclude the `default` entry while looping through a local JSON file?

For my project, I'm incorporating a JSON file from my local directory in the following manner: import * as RULES from './json/rules.json'; After importing it, I attempt to loop through its entries using the code snippet below: const rules ...

The links on my Bootstrap navigation menu are fully functional on mobile devices

While my WordPress website with a Bootstrap menu appears to work fine on desktop, I am facing an issue on mobile. The dropdown menu links do not respond when clicked. The hamburger button functionality seems intact as it opens and closes the dropdown menu ...

Discovering compatible properties within an array of objects (angular5)

I am working with an array of objects and need a way to identify matches between certain properties within the objects. Once identified, I want to save these matches in a new array. For example: [{id: 1, firstname: 'Bob', Lastname: 'Lupo&a ...

Navigating parameters effectively with Express Router

import express from "express"; const router = express.Router(); router.route("/:category").get(getProductsByCategories); router.route("/:id").get(getProductDetails); export default router; I have included two routes in the ...

What could be the reason for my Ajax failing to send the data to the external file?

My current setup involves sending data to an external PHP file via AJAX in order to generate a PDF using TCPDF and return it back to the page. However, I seem to be facing some issues with this process. Despite my efforts, I am unable to pinpoint the mist ...

Explanation of stdout and stderr in a child process using node.js version 8

I'm encountering an issue while attempting to initiate a child process in my node dev-server in order to configure the API json-server before launching it using the command: nom run dev -- reset The problem lies in the fact that the stdout and stder ...

What are the steps to designing your own unique custom button with Material-UI?

While Material-UI allows you to utilize withStyles() for creating a Button with a predefined set of styles, I am curious if it is achievable to achieve the same result using props instead. This would ensure that all custom buttons I create automatically ha ...

To grab a specific CSS attribute from a stylesheet using JavaScript

I am looking for a way to extract the value from a CSS file using a JavaScript function. Take a look at my code snippet below: HTML file -> <link rel="stylesheet" type="text/css" href="test_css.css" /> <script type="text/javascript ...

jQuery Ajax Redirect Form

I am currently developing an HTML application with a form. Upon clicking the submit button, I initiate a server-side call using jquery.ajax(). However, when the server returns an exception, such as a Status Code 500, I need to display an error message on t ...

Exploring the synergies between Angular Dragula and utilizing the $index property

Currently, I have implemented an ng-repeat of rows that can be rearranged using Angular Dragula. Despite successful drag-and-drop functionality, the $index in ng-repeat remains constant for each item even after reordering. The screenshot below depicts the ...

Adding a background image to a box in MUI is a simple task that can enhance

I've been attempting to include a background image in the Box component of mui, but I can't seem to get it to work. Here is the code I've been using: const Main = () => { return ( <Box sx={{backgroundImage:'images/cove ...

Avoid triggering a keydown event if certain div elements have been clicked

When the user presses the space bar, my script is set up to perform certain actions, such as stopping an audio player: $('html').keydown(function(e){ if(e.keyCode == 32){ // Stop the audio player } } However, an issue arises when a ...