How can I create a DIV center in Horizontal and vertical position with Jquery?

Hello

Is there any way to create a function or to put the DIV on the center of screen?

Thanks
LVL 1
hidrauAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hidrauAuthor Commented:
I saw this example but I didn't understand

maybe it is the solution

http://stackoverflow.com/questions/210717/using-jquery-to-center-a-div-on-the-screen
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hidrauAuthor Commented:
right, I got it.

it centered my div on the center of my screen.

But I tried to center my DIV inside the <td id="loading">  and it didn't work.

I have this css code for my DIV

#loading {
      position:absolute;
      width:246px;
      height:100px;
      z-index:1;
      background:#990000;
      display:block;
}


  $("#loading").show('fast');
  $("#loading").center({against:'lista_prd'});

my loading DIV is centered on the right of the top of my browse screen


0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

leakim971PluritechnicianCommented:
if you want to center it, why don't you let it << free >>?
absolute position and you put it in a cell?
0
hidrauAuthor Commented:
ok, I removed the absolute position and insert my div into the cell, my cell has align="center" valign="top"

then the DIV is obeying the align of my cell.

0
hidrauAuthor Commented:
this is my code where I inserted the DIV

    <td height="80" align="center" valign="top" background="Imagem/Loja/Menu_Fundo.jpg" bgcolor="#FFFFFF" id="lista_prd">
       <div id="loading">
         <table width="100%"  height="100%">
           <tr>
             <td align="center">
               <span style="font-size:18px;color:#FFFFFF">Aguarde! carregando ... </span>   <img src="loading.gif" width="32" height="32" />
             </td>
           </tr>
         </table>      
       </div>

       <img src="Imagem/banner_htm_link_2011.jpg" width="670" height="510" id="fundo" />
    </td>
0
leakim971PluritechnicianCommented:
why do you need to put it inside a cell if you want to center it?
could you put it in the body tag for example?
0
hidrauAuthor Commented:
I put in the body tag but it doesn't obey.
I am giving your the code of my screen so you can take a look at it



LojaMenu.txt
0
leakim971PluritechnicianCommented:
I can't locate the jquery plugins in your page
0
hidrauAuthor Commented:
it is because I have this
 <!--#include file="Bibli/libs_java.asp"-->    

where are all libriry declared

0
hidrauAuthor Commented:
leakim971: is there any way to create a float DIV and center it on the center of my screen?
0
leakim971PluritechnicianCommented:
0
hidrauAuthor Commented:
ok, I understood.

I just don't know why in my code it doesn't obey,

thake a look at the image
imagem.jpg
0
hidrauAuthor Commented:
you can see that is on the top / center of my screen and not on the center of code. :((
0
leakim971PluritechnicianCommented:
add the : $("body").css("position","");
0
hidrauAuthor Commented:
I did it and nothing.
0
hidrauAuthor Commented:
isn't the problem in my css?
0
leakim971PluritechnicianCommented:
>I did it and nothing.

It look horizontaly centered

could you provide a direct link to see the page?
0
hidrauAuthor Commented:
Hi leakim971.

I needed to stop the project for a while.

I will return soon
0
hidrauAuthor Commented:
thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.