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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:59:54+00:00 2026-06-16T02:59:54+00:00

I have this jquery http://jsfiddle.net/4Ns44/5/ The idea is to open an expanded view of

  • 0

I have this jquery

http://jsfiddle.net/4Ns44/5/

The idea is to open an expanded view of a div always in the view port. This works fine. And I want to stick to this method (NO fixed position divs).
But when the window is scrolled, I would like the expand window to move up as user scrolls up, but it SHOULD not scroll down if user scrolls down.

In the fiddle, if the user scrolls down after scrolling up, the expand div will scroll down until where it was originally opened.

Can anyone throw some light into margin-top and positioning on scroll?

  • 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-16T02:59:55+00:00Added an answer on June 16, 2026 at 2:59 am

    Try this: http://jsfiddle.net/4Ns44/6/

    It updates the expandY variable everytime you scroll and doesn’t let it move down the page from where it was previously.

    One thing to keep in mind: You should use e.preventDefault() to stop the link from being followed instead of return false. preventDefault() will still allow other events to fire, while return false will stop event execution in it’s tracks. It can cause confusion if you were to add other click handlers etc.

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

Sidebar

Related Questions

I have this pretty simple jquery example: http://jsfiddle.net/clifgray/NTd95/1/ and in that jsfiddle it works
I have this jQuery and HTML http://jsfiddle.net/UgX3u/30/ <div class=container> <div class=yellow></div> <div class=red></div> <div
i have a very conceptual question regarding jquery. i have this fiddle http://jsfiddle.net/zvCrN/ What
I have a simple jquery flipcard animation - http://jsfiddle.net/gGAW5/36/ Now the way this flip
I have this type of exercise in jquery. Go here http://jsfiddle.net/LAntL/3/ For Item 1
How can I do this with jQuery: http://jsfiddle.net/tdskate/C4nAG/ I need a div that automatically
HI I have this jquery menu here http://jsfiddle.net/pJMva/8/ and it doesnt seem to work
I have this example http://jsfiddle.net/HnfCU/ I use jQuery to show and hide the .child
i have this issue http://jsfiddle.net/valerioMassacci/LdCqX/ i have a specific div comments that onclick show
i have this script found here http://jsfiddle.net/g4txt/ i am using this carousel http://www.thomaslanciaux.pro/jquery/jquery_carousel.htm 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.