www.webdeveloper.com
Results 1 to 3 of 3

Thread: append loading div to the center of page

  1. #1
    Join Date
    Apr 2010
    Posts
    14

    append loading div to the center of page

    I display a div indicating the page is loading for all ajax request.

    here code to show the div

    Code:
    				    if (!document.getElementById('busy-symbol')) {
    				      busySymbol = document.createElement('div');
    				      busySymbol.id = 'busy-symbol';
    
    				        var busyLabel  = document.createElement('div');
    				        busyLabel.innerHTML = 'Loading ...';
    				        busySymbol.appendChild(busyLabel);
                                            document.body.appendChild(busySymbol);
    this code display the loading...div always on top of page , I want to display this in the center of page , please tell me how I can do that ?

  2. #2
    Join Date
    Sep 2010
    Posts
    62
    Create a div in the middle of your document that will hold the div you are creating on the fly. Nest your div inside the placeholder div when it is added and it will display correctly.

    Code:
    busydiv = document.getElementById('busy-section');
    busySymbol = document.createElement('div');
    busySymbol.id = 'busy-symbol';
    
    var busyLabel  = document.createElement('div');
    busyLabel.innerHTML = 'Loading ...';
    busySymbol.appendChild(busyLabel);
    busydiv.appendChild(busySymbol);

  3. #3
    Join Date
    Apr 2010
    Posts
    14
    can I float the div with the scrollbar, if I can then I need not worry about position , please sugest me how to float the div along with scroll bar?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles