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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:53:37+00:00 2026-06-05T00:53:37+00:00

I have an article: <article> Some paragraphs. </article> Below that I have my contact

  • 0

I have an article:

<article>
    Some paragraphs.
</article>

Below that I have my contact:

<div id="contact">
    stuff, this form is 600 px tall
</div>

contact is set to display:none;.

I use jQuery to toggle it. What I’m trying to do is modify this script from http://tutsplus.com/lesson/slides-and-structure/ so that it fades out the article text and then slides in the contact form. Having some trouble.

Code:

<script>

(function() {

$('html').addClass('js');

var contactForm = {

    container: $('#contact'),
    article: $('article'),

    init: function() {
        $('<button></button>', {
            text: 'Contact Me'
        })
            .insertAfter('article:first')
            .on('click', function() {
                console.log(this);
                this.show();
                // contactForm.article.fadeToggle(300);
                // contactForm.container.show();
            })
    },

    show: function() {
        contactForm.close.call(contactForm.container);
        contactForm.container.slideToggle(300);
    },

    close: function() {
        console.log(this);
        $('<span class=close>X</span>')
            .prependTo(this)
            .on('click', function(){
                contactForm.article.fadeToggle(300);
                contactForm.container.slideToggle(300);
            })
    }
};

contactForm.init();

})();

</script>

The part that is not working is:

.on('click', function() {
    console.log(this);
    this.show();
    // contactForm.article.fadeToggle(300);
    // contactForm.container.show();
})

When I do .on('click', this.show); it works fine, when I put this.show in a function it does not work!

  • 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-05T00:53:39+00:00Added an answer on June 5, 2026 at 12:53 am

    this.show() works just fine within close(), because this is within scope of close(), but not available within scope of .on('click') callback function, so you need to keep reference of this like below and reuse that.

     close: function() {
            // keeping reference
            var reference = this;
    
            $('<span class=close>X</span>')
                .prependTo(this)
                .on('click', function(){
                    //  using above reference here
                    reference.article.fadeToggle(300);
                    reference.container.slideToggle(300);
                })
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read from some article that say's Apple doesn't approve the application which
I have model Article it has field title with some text that may contain
Every now and then I find web applications that have some sort of article
I have some data that I want to present in a FlowDocument . This
For example, I have some class .article, and I want to view this class
I have a XML file that display the pubblications from an author with some
I have a problem with populateRelation , lets explain, that we have some Article,
I have some nested models in my Rails application. i have an article hat
I have following statement for query articles from some sections Article.all(:joins => :sections, :conditions
I have some xml: <article> <uselesstag></uslesstag> <topic>oil, gas</topic> <body>body text</body> </article> <article> <uselesstag></uslesstag> <topic>food</topic>

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.