Hi folks,

I'm having difficulty with a flicker/repaint of an 'unhidden' div in
the following scenario

A user clicks on a region of an image map and triggers the following
function which 'unhides' previously populated divs, each with an id of
the clicked region and each containing a list of businesses in that
region.  I'm sure there is a more elegant way of doing this, but what
my code below is sort of doing is to hide all visible divs and then
unhide the one associated with the clicked region on the map.  There
is a bulldozer in there as I hide all divs, whether they are visible
or not - simply because I don't know how to specify the one that is
showing (or to exclude the one to be shown).  These points of good
style aside, the code does most of what I require.

What I can't understand is that when I click a second region (placing
"me" in the first part of the if statement), the unhidden div becomes
visible but then disappears before returning to stay.

I thought that by putting the .."$("#"+ej).show(600);".. bit in a
function after the divs were hidden would mean that the unhiding of
the ej div would occur after all the others had been (re)hidden.

The code behind this is:

function chooseRegion(ej){
    var pj = $('#regions div');
    if (pj.is(':visible')){
        //console.log("1 " + ej);
    $(pj).hide(100,function(){
    $("#"+ej).show(600);});
    } else {
        //console.log("2 " + ej);
    $("#"+ej).show(500);
    };
}

How do I stop the refresh/flicker - or how can I approach this in a
better way?

Thanks,

Bruce

Reply via email to