Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8069593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:06:02+00:00 2026-06-05T13:06:02+00:00

I have an iframe tag and I want to dynamically change it using jquery

  • 0

I have an iframe tag and I want to dynamically change it using jquery animation. So for example the iframe sits on the home page, and if i click the about link, it will load the about.html and when its ready it will slide it down using animation.
I have the basic logic for it but then came about this

problem:

When I refresh the page it loads back the content of the index.html page, and what I want is that when I refresh it, it still keeps the contents of about.html.

  <a href="about.html" target="content">About</a> 
  <iframe id="content" name="content" align="top" src="index.html" 
      frameborder="0" width="100%" height="1200px" scrolling="no">
  </iframe>

this is just the most basic logic, but I need help on how do I achieve the refreshing part/

and what if i dont include them in the same page but I still want to animate the page transitions. so when the users clicks a link to a new page, it will load it, and then animate it.How can I achieve this. Because recently I saw a jquery plugin callen LocalScroll and they achieve this effect, but i couldnt get it to work for new pages

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T13:06:04+00:00Added an answer on June 5, 2026 at 1:06 pm

    You can use the following to change the src attribute of the iFrame:

    $("#content").attr('src', 'http://mysite.com/newpage.html');

    Oops, looks like I misread the question.

    If you want to slide it down, you can bind an event handler to the load event (jQuery doc) to do something when the frame loads.

    $("#content").hide();
    
    $("#loadLink").click(function() {
        $("#content").hide();
        $("#content").attr('src', 'http://mysite.com/newpage.html');
    });
    
    $("#content").load(function() {
        $(this).slideDown();
    });
    

    In this example, the iframe is hidden when you click the link, and when it is ready, it slides down.

    Demo

    Edit: still misread it!

    To save the state of which page is last shown in the iframe, you can use HTML5 localStorage.

    In the load event of the iframe save the page that it’s currently showing.

    localStorage['lastPage'] = "about.html"
    

    and then load it back using localStorage['lastPage'] on page load.

    Updated demo showing both sliding and keeping the page after refresh.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page that contains an iframe element. I want to have some
I have a website that consists of one parent page. Using the lightbox-style jQuery
On my page, I have an iframe tag that I control. The iframe src
I have an iframe in my html page and I want to access some
I have an iframe in my page and I want to display the content
I have iframe inside my page for save data in database.I use validate.js to
i know i can have iframe in a html page, say parent.htm, and i
I have an iframe with parameters inside the src url like this: <iframe src=http://www.form-page.com?suppressRedirect=1&A=1841
I have a iframe that i want to open pdf's into from a list
I have an IFrame on my page pointing to a page containing list of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.