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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T13:32:07+00:00 2026-05-19T13:32:07+00:00

I want to move a div that is normally floating on the right side

  • 0

I want to move a div that is normally floating on the right side to an absolute position (determined by js) and then back to its initial position.

The first part already works and relies on setting the "style. " tags for the object.. something like

mytarget.style.position="absolute";
mytarget.style.top="50px";

To move it back, i would like to just assign the standard class back to the element , which will also contain the positioning info.

Strangely enough, everything but repositioning will work.
Here’s the relevant code:

var mytarget= document.getElementById(titlebarid);
var newclass=tabstyleclasses[titlebarid][ismaxedtab[titlebarid]];



mytarget.className= newclass ;

Debug:

 alert ("wanting to set : " + newclass  )    ;

This outputs the correct value. ("adfieldtitlesm")

alert ("my target is " +mytarget.id);

Works as well.

alert ("new class is " + mytarget.className );

Gives out the correct value too. ("adfieldtitlesm")

alert ("new position is " + mytarget.style.position );

Gives out "absolute" (as previously set by JS when moving the mytarget) , should be "fixed"

This is the CSS class :

.adfieldtitlesm
 {
  position: fixed;
 top: 200px;
 left: 50px;
 
 font-size: 50px;
 background-color: #000000;
 color: #ffffff;
 
 }

Why won’t the object move after its class has been set?

UPDATE: Link

Main test page

The relevant parts to this are lines 270-297(mostly 290-294) within rebuildtabs() for the first move , which works
and lines 160-183 within minwidget()
Apologies for the slightly messy code 🙂

  • 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-19T13:32:08+00:00Added an answer on May 19, 2026 at 1:32 pm

    Because the inline properties override class properties, you’ll need to remove the inline.

    mytarget.style.position="";
    

    Then the fixed position defined in the class will work.

    Or perhaps use:

    delete mytarget.style.position;
    

    Not sure which is prefered.

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

Sidebar

Related Questions

I want to move a right menu to the left side, the problem is
I have a div element that I want to move with the page for
I want to move a div down a page, and I want it to
I have to create an 'X' that pops up over the top right div
I want to make a div animate horizontally back and forth within a certain
I have a DIV container which position is absolute and I'm having a draggable
i have <div id=logo style=border: 3px coral solid;position:absolute;left:160px;top:35px;width:140px; height:100px; z-index:5> <img src=img.png ></img> </div>
I would like to move one DIV element inside another. For example, I want
All I want to do is have a div move down the page to
I want to move multiple DIV with arrow keys and javascript (without jquery). All

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.