html - "dancing divs" using jquery .innerhtml, .appendto and setInterval -
i'm working on html/javascript game has spell bar (div) spells show count down (also divs). when more 1 of spell divs added positioned below container div.
i've attached jsfiddle link code. searched everywhere on google, didn't found answers.
i tried using function instead of setinterval
, no results.
function interval(func, wait, times){ var interv = function(w, t){ return function(){ if(typeof t === "undefined" || t-- > 0){ settimeout(interv, w); try{ func.call(null); } catch(e){ t = 0; throw e.tostring(); } } }; }(wait, times); settimeout(interv, wait); };
replacing old 1 with
interval(function(){ hbspelldown(champname, slot, cd); }, 1000, cd);
i tried commenting out of danger_spell
, danger_spell_inner
, didn't either.
without setinterval
part works, need show countdown.
can me issue? thank you!
this seems caused inner div causing outer div re-positioned. try putting position: absolute;
in style danger_spell_inner
.
Comments
Post a Comment