Skip to main content
Post Reopened by Stphane, Adrian Mole, CPlus
added 183 characters in body
Source Link
owino
  • 143
  • 1
  • 3
  • 11

I am developing a dynamic website using jQuery which relies heavily on AJAX operations. Whenever an AJAX operation starts, a progress bar is shown which I have positioned in the middle of the web page.

I am finding it tiresome for a visitor switching their eyes from the element they have clicked to watch the progress bar which may be kilometers away from the element, then come back to the element or around it when the progress bar vanishes.

How should I position the progress bar around the element?

So far, I tried to register a handler called when the next AJAX request begins, as follows...

$(document).on('ajaxStart', ()=>{
  $('#parentOfBar').append("<div id=progressBarElem style='display:none;position:absolute;top:50%;left:50%;padding:2px;' ></div>");
  $('#progressBarElem').html('A moment, please wait...');
  $('#progressBarElem').progressbar({value: false});
  $('#progressBarElem').show();
});

When an AJAX operation begins, the progress bar appears at the center of the screen as I have specified using CSS. As I have stated, I would like it to appear next to the element that has triggered the AJAX operation (by say having been clicked).

I just figured out that instead of appending the div element (which becomes the progress bar once a child of some some fixed element), I could solve this by making it a sibling of the element which has the focus and removing its position CSS property as follows...

$(document).on('ajaxStart', ()=>{
    $fucusedElem = $( document.activeElement ) //the currently focused element
    $fucusedElem.parent().append("<div id=progressBarElem style='display:none;top:50%;left:50%;padding:2px;' ></div>");
    $('#progressBarElem').html('A moment, please wait...');
    $('#progressBarElem').progressbar({value: false});
    $('#progressBarElem').show();
});

The progress bar now appears next to the element causing it (the progress bar) to pop up. This is by adding the progress bar as a sibling of the element that has the focus. This way, when the progress bar does appear, it interferes with the layout of the nearby elements.

Is this the best solution or could there be a better way of telling which element caused an AJAX operation to start instead of relying on the element that has focus?

I am developing a dynamic website using jQuery which relies heavily on AJAX operations. Whenever an AJAX operation starts, a progress bar is shown which I have positioned in the middle of the web page.

I am finding it tiresome for a visitor switching their eyes from the element they have clicked to watch the progress bar which may be kilometers away from the element, then come back to the element or around it when the progress bar vanishes.

How should I position the progress bar around the element?

So far, I tried to register a handler called when the next AJAX request begins, as follows...

$(document).on('ajaxStart', ()=>{
  $('#parentOfBar').append("<div id=progressBarElem style='display:none;position:absolute;top:50%;left:50%;padding:2px;' ></div>");
  $('#progressBarElem').html('A moment, please wait...');
  $('#progressBarElem').progressbar({value: false});
  $('#progressBarElem').show();
});

When an AJAX operation begins, the progress bar appears at the center of the screen as I have specified using CSS. As I have stated, I would like it to appear next to the element that has triggered the AJAX operation (by say having been clicked).

I just figured out that instead of appending the div element (which becomes the progress bar once a child of some some fixed element), I could solve this by making it a sibling of the element which has the focus and removing its position CSS property as follows...

$(document).on('ajaxStart', ()=>{
    $fucusedElem = $( document.activeElement ) //the currently focused element
    $fucusedElem.parent().append("<div id=progressBarElem style='display:none;top:50%;left:50%;padding:2px;' ></div>");
    $('#progressBarElem').html('A moment, please wait...');
    $('#progressBarElem').progressbar({value: false});
    $('#progressBarElem').show();
});

The progress bar now appears next to the element causing it (the progress bar) to pop up.

Is this the best solution or could there be a better way of telling which element caused an AJAX operation to start instead of relying on the element that has focus?

I am developing a dynamic website using jQuery which relies heavily on AJAX operations. Whenever an AJAX operation starts, a progress bar is shown which I have positioned in the middle of the web page.

I am finding it tiresome for a visitor switching their eyes from the element they have clicked to watch the progress bar which may be kilometers away from the element, then come back to the element or around it when the progress bar vanishes.

How should I position the progress bar around the element?

So far, I tried to register a handler called when the next AJAX request begins, as follows...

$(document).on('ajaxStart', ()=>{
  $('#parentOfBar').append("<div id=progressBarElem style='display:none;position:absolute;top:50%;left:50%;padding:2px;' ></div>");
  $('#progressBarElem').html('A moment, please wait...');
  $('#progressBarElem').progressbar({value: false});
  $('#progressBarElem').show();
});

When an AJAX operation begins, the progress bar appears at the center of the screen as I have specified using CSS. As I have stated, I would like it to appear next to the element that has triggered the AJAX operation (by say having been clicked).

I just figured out that instead of appending the div element (which becomes the progress bar once a child of some some fixed element), I could solve this by making it a sibling of the element which has the focus and removing its position CSS property as follows...

$(document).on('ajaxStart', ()=>{
    $fucusedElem = $( document.activeElement ) //the currently focused element
    $fucusedElem.parent().append("<div id=progressBarElem style='display:none;top:50%;left:50%;padding:2px;' ></div>");
    $('#progressBarElem').html('A moment, please wait...');
    $('#progressBarElem').progressbar({value: false});
    $('#progressBarElem').show();
});

The progress bar now appears next to the element causing it (the progress bar) to pop up. This is by adding the progress bar as a sibling of the element that has the focus. This way, when the progress bar does appear, it interferes with the layout of the nearby elements.

Is this the best solution or could there be a better way of telling which element caused an AJAX operation to start instead of relying on the element that has focus?

Misc typo and grammar fixes
Source Link
Stphane
  • 3.4k
  • 5
  • 34
  • 47

I am developing a dynamic website withusing jQuery which relies heavily on AJAX operations. Whenever an AJAX operation starts I pop up, a progress bar is shown which I have positioned in the middle of the webpageweb page.

I am finding it tiresome for a visitor switching their eyes from the the element they have clicked to watch the progress bar which may be 'kilometres'kilometers away from the element, then come back to the element or around it when the progress bar vanishes.

How doshould I position the progress bar around the element?

WhatSo far, I have done istried to register a handler to be called when the next AjaxAJAX request begins, as follows...

$(document).on('ajaxStart', ()=>{
  $('#parentOfBar').append("<div id=progressBarElem style='display:none;position:absolute;top:50%;left:50%;padding:2px;' ></div>");
  $('#progressBarElem').html('A moment, please wait...');
  $('#progressBarElem').progressbar({value: false});
  $('#progressBarElem').show();
});

When an AJAX operation commencesbegins, the progress the bar appears at the centrecenter of the screen as I have specified by theusing CSS. As I have stated, I would like it to appear next to the element that has triggered the AJAX operation (by say having been clicked).

Just as I am editing this question for clarity, I havejust figured out that instead of appending the div element that(which becomes the progress bar asonce a child of some some fixed element), I could solve this by making it a sibling of the element which has the focus and removing its position CSS property as follows...

$(document).on('ajaxStart', ()=>{
    $fucusedElem = $( document.activeElement ) //the currently focused element
    $fucusedElem.parent().append("<div id=progressBarElem style='display:none;top:50%;left:50%;padding:2px;' ></div>");
    $('#progressBarElem').html('A moment, please wait...');
    $('#progressBarElem').progressbar({value: false});
    $('#progressBarElem').show();
});

The progress bar is now placedappears next to the element 'that is causing'causing it (the progress bar) to pop up.

Is this the best solution? Could or could there be a better way of telling thewhich element that caused an AJAX operation to commencestart instead of relying on the element that has focus?

I am developing a dynamic website with jQuery which relies heavily on AJAX operations. Whenever an AJAX operation starts I pop up a progress bar which I have positioned in the middle of the webpage.

I am finding it tiresome for a visitor switching their eyes from the the element they have clicked to watch the progress bar which may be 'kilometres' away from the element, then come back to the element or around it when the progress bar vanishes.

How do I position the progress bar around the element?

What I have done is register a handler to be called when the next Ajax request begins as follows...

$(document).on('ajaxStart', ()=>{
  $('#parentOfBar').append("<div id=progressBarElem style='display:none;position:absolute;top:50%;left:50%;padding:2px;' ></div>");
  $('#progressBarElem').html('A moment, please wait...');
  $('#progressBarElem').progressbar({value: false});
  $('#progressBarElem').show();
});

When an AJAX operation commences, the progress the bar appears at the centre of the screen as I have specified by the CSS. As I have stated, I would like it appear next to the element that has triggered the AJAX operation (by say having been clicked).

Just as I am editing this question for clarity, I have figured out that instead of appending the div element that becomes the progress bar as a child of some some fixed element, I could solve this by making it a sibling of the element which has the focus and removing its position CSS property as follows...

$(document).on('ajaxStart', ()=>{
    $fucusedElem = $( document.activeElement ) //the currently focused element
    $fucusedElem.parent().append("<div id=progressBarElem style='display:none;top:50%;left:50%;padding:2px;' ></div>");
    $('#progressBarElem').html('A moment, please wait...');
    $('#progressBarElem').progressbar({value: false});
    $('#progressBarElem').show();
});

The progress bar is now placed next to the element 'that is causing' it (the progress bar) to pop up.

Is this the best solution? Could there be a better way of telling the element that caused an AJAX operation to commence instead of relying on the element that has focus?

I am developing a dynamic website using jQuery which relies heavily on AJAX operations. Whenever an AJAX operation starts, a progress bar is shown which I have positioned in the middle of the web page.

I am finding it tiresome for a visitor switching their eyes from the element they have clicked to watch the progress bar which may be kilometers away from the element, then come back to the element or around it when the progress bar vanishes.

How should I position the progress bar around the element?

So far, I tried to register a handler called when the next AJAX request begins, as follows...

$(document).on('ajaxStart', ()=>{
  $('#parentOfBar').append("<div id=progressBarElem style='display:none;position:absolute;top:50%;left:50%;padding:2px;' ></div>");
  $('#progressBarElem').html('A moment, please wait...');
  $('#progressBarElem').progressbar({value: false});
  $('#progressBarElem').show();
});

When an AJAX operation begins, the progress bar appears at the center of the screen as I have specified using CSS. As I have stated, I would like it to appear next to the element that has triggered the AJAX operation (by say having been clicked).

I just figured out that instead of appending the div element (which becomes the progress bar once a child of some some fixed element), I could solve this by making it a sibling of the element which has the focus and removing its position CSS property as follows...

$(document).on('ajaxStart', ()=>{
    $fucusedElem = $( document.activeElement ) //the currently focused element
    $fucusedElem.parent().append("<div id=progressBarElem style='display:none;top:50%;left:50%;padding:2px;' ></div>");
    $('#progressBarElem').html('A moment, please wait...');
    $('#progressBarElem').progressbar({value: false});
    $('#progressBarElem').show();
});

The progress bar now appears next to the element causing it (the progress bar) to pop up.

Is this the best solution or could there be a better way of telling which element caused an AJAX operation to start instead of relying on the element that has focus?

added 143 characters in body
Source Link
owino
  • 143
  • 1
  • 3
  • 11

I am developing a dynamic website with jQuery which relies heavily on AJAX operations. Whenever an AJAX operation starts I pop up a progress bar which I have positioned in the middle of the webpage.

I am finding it tiresome for a visitor switching their eyes from the the element they have clicked to watch the progress bar which may be 'kilometres' away from the element, then come back to the element or around it when the progress bar vanishes.

How do I position the progress bar around the element?

What I have done is register a handler to be called when the next Ajax request begins as follows...

$(document).on('ajaxStart', ()=>{
  $('#parentOfBar').append("<div id=progressBarElem style='display:none;position:absolute;top:50%;left:50%;padding:2px;' ></div>");
  $('#progressBarElem').html('A moment, please wait...');
  $('#progressBarElem').progressbar({value: false});
  $('#progressBarElem').show();
});

When an AJAX operation commences, the progress the bar appears at the centre of the screen as I have specified by the CSS. As I have stated, I would like it appear next to the element that has triggered the AJAX operation (by say having been clicked).

Just as I am editing this question for clarity, I have figured out that instead of appending the div element that becomes the progress bar as a child of some some fixed element, I could solve this by making it a sibling of the element which has the focus and removing its position CSS property as follows...

$(document).on('ajaxStart', ()=>{
    $fucusedElem = $( document.activeElement ) //the currently focused element
    $fucusedElem.parent().append("<div id=progressBarElem style='display:none;top:50%;left:50%;padding:2px;' ></div>");
    $('#progressBarElem').html('A moment, please wait...');
    $('#progressBarElem').progressbar({value: false});
    $('#progressBarElem').show();
});

The progress bar is now placed next to the element 'that is causing' it (the progress bar) to pop up.

Is this the best solution? Could there be a better way of telling the element that caused an AJAX operation to commence instead of relying on the element that has focus?

I am developing a dynamic website with jQuery which relies heavily on AJAX operations. Whenever an AJAX operation starts I pop up a progress bar which I have positioned in the middle of the webpage.

I am finding it tiresome for a visitor switching their eyes from the the element they have clicked to watch the progress bar which may be 'kilometres' away from the element, then come back to the element or around it when the progress bar vanishes.

How do I position the progress bar around the element?

What I have done is register a handler to be called when the next Ajax request begins as follows...

$(document).on('ajaxStart', ()=>{
  $('#parentOfBar').append("<div id=progressBarElem style='display:none;position:absolute;top:50%;left:50%;padding:2px;' ></div>");
  $('#progressBarElem').html('A moment, please wait...');
  $('#progressBarElem').progressbar({value: false});
  $('#progressBarElem').show();
});

When an AJAX operation commences, the progress the bar appears at the centre of the screen as I have specified by the CSS. As I have stated, I would like it appear next to the element that has triggered the AJAX operation (by say having been clicked).

Just as I am editing this question for clarity, I have figured out that instead of appending the div element that becomes the progress bar as a child of some some fixed element, I could solve this by making it a sibling of the element which has the focus and removing its position CSS property as follows...

$(document).on('ajaxStart', ()=>{
    $fucusedElem = $( document.activeElement ) //the currently focused element
    $fucusedElem.parent().append("<div id=progressBarElem style='display:none;top:50%;left:50%;padding:2px;' ></div>");
    $('#progressBarElem').html('A moment, please wait...');
    $('#progressBarElem').progressbar({value: false});
    $('#progressBarElem').show();
});

The progress bar is now placed next to the element 'that is causing' it (the progress bar) to pop up.

Is this the best solution?

I am developing a dynamic website with jQuery which relies heavily on AJAX operations. Whenever an AJAX operation starts I pop up a progress bar which I have positioned in the middle of the webpage.

I am finding it tiresome for a visitor switching their eyes from the the element they have clicked to watch the progress bar which may be 'kilometres' away from the element, then come back to the element or around it when the progress bar vanishes.

How do I position the progress bar around the element?

What I have done is register a handler to be called when the next Ajax request begins as follows...

$(document).on('ajaxStart', ()=>{
  $('#parentOfBar').append("<div id=progressBarElem style='display:none;position:absolute;top:50%;left:50%;padding:2px;' ></div>");
  $('#progressBarElem').html('A moment, please wait...');
  $('#progressBarElem').progressbar({value: false});
  $('#progressBarElem').show();
});

When an AJAX operation commences, the progress the bar appears at the centre of the screen as I have specified by the CSS. As I have stated, I would like it appear next to the element that has triggered the AJAX operation (by say having been clicked).

Just as I am editing this question for clarity, I have figured out that instead of appending the div element that becomes the progress bar as a child of some some fixed element, I could solve this by making it a sibling of the element which has the focus and removing its position CSS property as follows...

$(document).on('ajaxStart', ()=>{
    $fucusedElem = $( document.activeElement ) //the currently focused element
    $fucusedElem.parent().append("<div id=progressBarElem style='display:none;top:50%;left:50%;padding:2px;' ></div>");
    $('#progressBarElem').html('A moment, please wait...');
    $('#progressBarElem').progressbar({value: false});
    $('#progressBarElem').show();
});

The progress bar is now placed next to the element 'that is causing' it (the progress bar) to pop up.

Is this the best solution? Could there be a better way of telling the element that caused an AJAX operation to commence instead of relying on the element that has focus?

deleted 9 characters in body
Source Link
owino
  • 143
  • 1
  • 3
  • 11
Loading
added 435 characters in body
Source Link
owino
  • 143
  • 1
  • 3
  • 11
Loading
added 435 characters in body
Source Link
owino
  • 143
  • 1
  • 3
  • 11
Loading
added 521 characters in body
Added to review
Source Link
owino
  • 143
  • 1
  • 3
  • 11
Loading
added 521 characters in body
Source Link
owino
  • 143
  • 1
  • 3
  • 11
Loading
added 433 characters in body
Source Link
owino
  • 143
  • 1
  • 3
  • 11
Loading
Post Closed as "Not suitable for this site" by mplungjan, Paulie_D, gnat
edited body
Source Link
mplungjan
  • 174.5k
  • 28
  • 180
  • 240
Loading
Source Link
owino
  • 143
  • 1
  • 3
  • 11
Loading