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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:42:26+00:00 2026-06-17T22:42:26+00:00

I am a neophyte when it comes to javascript. I am a UX designer

  • 0

I am a neophyte when it comes to javascript. I am a UX designer and I am trying to use some code in my personal website. So far, it’s going well, but I am having an error that google has not helped me figure out so far.

What I am doing is having a button that does the follow:

  1. On click, it stats a .toggle with a callback.
  2. The first part of the callback uses .slideDown to open up a section and scroll it down to reveal hidden content
  3. At the same time, it moves the top of the section to be 50px from the top of the page, regardless where it was when you clicked it. This is so the hidden content now fills the page.

This part works fine, error free. Here is my problem.

  1. In the callback, I want it to use .slideUp to close the content area again. This works fine.
  2. But when I try to use the scrollTop: again, I get this error:

    Uncaught TypeError: Property ‘top’ of object # is not a function

Here is my coffeescript:

jQuery(document).ready theExpander = ->
  jQuery("#expander").toggle (->
    # first callback to slide it down
    jQuery(".expanding").slideDown 1000
    jQuery(this).toggleClass "darker"
    jQuery("html, body").animate
      scrollTop: jQuery(this).offset().top - 50
    , 600
    jQuery(".more").addClass "hidden"
    jQuery(".less").addClass "shown"
  ), ->
    # second callback to slide it up
    jQuery(".expanding").slideUp 1000
    jQuery(this).toggleClass "darker"
    jQuery("html, body").animate
      scrollTop: jQuery(this).offset().top 200
    , 600
    jQuery(".more").removeClass "hidden"
    jQuery(".less").removeClass "shown"

The error appears on the 2nd click of the button which is initiating the callback. I have no inkling as to why this is. Can I not have the callback use the same scrollTop twice?

Does anyone have an idea on what I am doing here? If I remove those lines on the 2nd callback, it works without an error:

    jQuery("html, body").animate
      scrollTop: jQuery(this).offset().top 200
    , 600

Where do I start with this? Do I need to reidentify an ID in the 2nd callback for the Property 'top' of object #<Object> is not a function error or omission?

I’m writing this through extreme trial and error, this is the first callback I’ve ever done. If someone can point out the error of my ways, it would be much appreciated.

  • 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-17T22:42:28+00:00Added an answer on June 17, 2026 at 10:42 pm
    jQuery(this).offset().top 200
    

    is translated to

    jQuery(this).offset().top(200)
    

    and since top isn’t a function, but a property, you get an error.

    Did you mean this?

    jQuery(this).offset().top - 200
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm an XML neophyte having some weird issues with parsing a schema. Here's a
I've been looking to read some ruby code(specifically Rails) but I don't want to
I'm a neophyte with Oracle and PL/SQL; I'm having some issues with a select
I'm still a neophyte Python programmer and I'm trying to do something that is
I'm still a neophyte when it comes to SQL queries, so I was hoping
Given code like this from a node.js neophyte like me: require('http').createServer(function( req, resp )
Trying to use the GMM package in R to estimate the parameters (a-f) of
I'm neophyte in obj-c, so I cant understand some of this logic. I want
Hi all I am a neophyte in Backbone.js. I am trying to get my
Hadoop(and Java) neophyte here. I needed some help with using MultipleTextOutputFormat to control the

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.