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

  • Home
  • SEARCH
  • 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 4247140
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:04:05+00:00 2026-05-21T04:04:05+00:00

Creating this ajax styled wordpress portfolio theme and I’m a little stuck on how

  • 0

Creating this ajax styled wordpress portfolio theme and I’m a little stuck on how to do this one last little thing.

Basically lets say you click the “About” link at the top right it will load the contents of that page into a div. Now once thats clicked how do I specify that if that link gets clicked again for it not to load the contents again?

Now you will think to use length, that is not really the issue.

Here’s a link to the theme in progress http://themes.thefinishedbox.com/portfolio/

Here’s the javascript used for the top navigation:

$(function() {
    $('#navigation ul > li a').each(function() {

        $(this).click(function(e) {

            $.ajaxSetup ({  
                cache: false  
            });

            e.preventDefault();

            var $href = $(this).attr('href'); 

            var $loader = '<div id="whiteLoader" />';

            if($('#page').length == 0) {

                $('<div id="page" />').insertAfter('#header');

                $('#page').queue(function() {
                    $(this).animate({height: '120px'}, 300);
                    $(this).html($loader);
                    $(this).animate({backgroundColor: '#fff'}, 300);
                    $(this).dequeue();                    
                });

                $('#page').queue(function() {
                    $('#page').load($href + ' #pageEntry', function() {
                        var $height = $('#pageEntry').height();
                        var $h = $height + 16;
                        $(this).animate({height: $h + 'px'}, 600, function() {
                            $(this).css({height: 'auto'});
                        });
                        // This is the sort of thing I'm trying to achieve
                        // is it out of scope? Not sure of the correct way
                        // to achieve this.
                        e.click(function() { return false; }); 
                    });
                    $(this).dequeue();
                });

            } else {

                $('#pageEntry').animate({height: 0}, 600, function() {

                    $(this).remove();

                    $('#page').queue(function() {
                        $(this).animate({height: '120px'}, 300);
                        $(this).html($loader);
                        $(this).animate({backgroundColor: '#fff'}, 300);
                        $(this).dequeue();                    
                    });

                    $('#page').queue(function() {
                        $('#page').load($href + ' #pageEntry', function() {
                            var $height = $('#pageEntry').height();
                            var $h = $height + 16;
                            $(this).animate({height: $h + 'px'}, 600, function() {
                                $(this).css({height: 'auto'});
                            });
                        });
                        $(this).dequeue();
                    });

                });
            }

        });

    });
});

Don’t worry too much about the else statement right now, refer to the commented line, am I doing it right? Out of scope? Surely someone has came across this issue before.

Any help would be greatly appreciated.

p.s I’m aware a lot of the code can be minified down, I will do that later.

  • 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-05-21T04:04:05+00:00Added an answer on May 21, 2026 at 4:04 am

    You could use the one() function to ensure the event handler is only run once. Alternatively, you could use data() to bind a boolean to the element, indicating whether or not the element is currently “active” (i.e. having its content displayed). For reference, both of these functions are JQuery functions.

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

Sidebar

Related Questions

I am new to AJAX and have this issue. I am creating a photogallery
How can I have it so Visual Studio doesn't keep re-creating this folder that
Note: I found this Creating a Word Doc in C#.NET , but that is
I asked this Can I automate creating a .NET web application in IIS? a
I had this idea of creating a count down timer, like 01:02, on the
I'm currently creating an explicit reference to this in the outer class so that
I'm creating a table that looks something like this. CREATE TABLE packages ( productCode
I am new to creating Java web applications and came across this problem when
Hello can anybody solve this please I'm creating the object in the action class
I'm doing this system Stacked and I am creating the search function. And in

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.