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 8620095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:30:00+00:00 2026-06-12T06:30:00+00:00

I’m trying to create a fade or slide transition using jQuery or CSS (or

  • 0

I’m trying to create a fade or slide transition using jQuery or CSS (or otherwise!) on php included pages which sit within a DIV. I’ve searched around and found loads of examples of fade transitions which fade divs with one another or fade in hidden content but this situation is slightly different.

I have one DIV whose content is controlled by the nav bar. Each page is successfully included within the div using PHP when it is selected but I’m wanting to make the content fade in and out.

Any ideas on how to make a nice looking transition between page changes?

Many thanks

Code:

<?php
    if (isset($_GET['page']))
    $page = $_GET['page'];

    else {
            $_GET['page'] = 1;
            $page = $_GET['page'];
}
?>

and then the pages are included in a div like so:

<div id="content">
      <?php switch($page)
    {       
            case "about":
            include('includes/about.php');
            break;

            case "portfolio":
            include('includes/portfolio.php');
            break;

            case "contact":
            include('includes/contact.php');
            break;

            default:
                include('includes/home.php');
            }
?>
    </div>

The content is selected from a nav bar:

<ul>
  <li><a href="m_index.php?page=home"><img src="" width="32" height="32" alt="Home"/></a></li>
  <li><a href="m_index.php?page=about"><img src="" width="32" height="32" alt="About" /></a></li>
  <li><a href="m_index.php?page=portfolio"><img src="" width="32" height="32" alt="Portfolio" /></a></li>
  <li><a href="m_index.php?page=contact"><img src="" width="32" height="32" alt="Contact Us" /></a></li>
</ul>
  • 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-12T06:30:02+00:00Added an answer on June 12, 2026 at 6:30 am

    Like people said in the comments, you’re reloading the whole page everytime.

    You can use jQuery.load API to load the content instead of including them in php.

    PHP:

    <div id="content">
        <?php
        // load home by default - the rest will be loaded via AJAX
        include("includes/home.php");  ?>
    </div>​
    

    HTML for navbar:

    <ul id="links">
        <li><a href="m_index.php?page=home"><img src="" width="32" height="32" alt="Home"/></a></li>
        <li><a href="includes/about.php"><img src="" width="32" height="32" alt="About" /></a></li>
        <li><a href="includes/portfolio.php"><img src="" width="32" height="32" alt="Portfolio" /></a></li>
        <li><a href="includes/contact.php"><img src="" width="32" height="32" alt="Contact Us" /></a></li>
    </ul>
    ​
    ​
    

    With jQuery, you do something like this:

    $(document).ready(function() {
        $('#links a').click(function(e) {
            e.preventDefault(); // we'll get the pages via ajax.
    
            var url = $(this).attr('href'); // use href as url to loag
    
            $.ajax({
                url: url,
                success: function(data) {
    
                    // when ajax is done, fade old content out
                    $('#content').fadeOut(function() {
    
                        $(this).html(data); // replace contents
    
                        // fade new content in
                        $(this).fadeIn();
                    });
                }
            });
        });
    });​​​​
    

    I haven’t tested the jQuery code, but it should work (or give you some ideas).
    You might want to clean up the php code also, if all goes well.

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

Sidebar

Related Questions

I'm trying to create an if statement in PHP that prevents a single post
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm trying to select an H1 element which is the second-child in its group
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.