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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:16:15+00:00 2026-06-04T22:16:15+00:00

I am having an issue unsetting the offset of an element. Here is my

  • 0

I am having an issue unsetting the offset of an element. Here is my code in jsfiddle: http://jsfiddle.net/hhQH2/39/

And here is my code:
HTML:

<div class="div" id="378246"></div>
<div class="promoBook" id="378246"></div>
<div class="availability"><div class="avClose">X</div></div>
<div class='tellme'></div>

CSS:

.promoBook{
margin-top: 100px;
margin-left: 100px;
background: #333;
width: 120px;
height: 45px;
    color: #fff;
}
.availability{
position: absolute;
background: red;
width: 200px;
height: 150px;
    display: none;
}

JQUERY:

//pop up availability 
$(".promoBook").click(function(){
    var btnavail = $(".availability");
    var bookId = $(this).attr("id");
    var btnpos = $(this).offset();

    $(".tellme").text(btnpos.left + btnpos.top);

    //change position of availability div
    btnavail.offset(btnpos);
    btnavail.show();
    $(".avClose").click(function(){
    btnavail.hide();
    btnavail.offset({left:0,top:0});    
    });

    });​

The main problem is that it is not erasing the set offset… it holds the old one and adds the new. I hope this makes sense.. any help would be greatly 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-04T22:16:16+00:00Added an answer on June 4, 2026 at 10:16 pm

    In the jQuery doc :

    Note: jQuery does not support getting the offset coordinates of hidden elements or accounting for borders, margins, or padding set on the body element.

    I believe it is the same when you want to set it 😉

    To resolve your problem, just reverse the two lines of close method :

    $(".avClose").click(function(){
        btnavail.offset({left:0,top:0});    
        btnavail.hide();
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having an issue here that I have tried everything I can think of but
I am having an issue with caching the home page of my Asp.Net Mvc
I am having really upsetting issue with Struts(2.2.3). Here is my field validations on
I am having issue setting a cookie to a web-service call in .NET. Before
I'm having an issue unsetting my parent if I do not find my needle
I am having issue with Google line chart API. When I reload the div,
I am having issue with loading a html textarea via ajax, essentially the text
I am trying to implement BST algorithm using Cormen's pseudo code yet having issue.
Having an issue with type conversion in ASP classic. heres my code: Set trainingCost
I am having issue in compiling code having templated classes nested within other templated

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.