Page 421 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 421

k;
                       el_id  =  $(el).attr('id');
                       //pos =  $(el).css('background-position'); //for some  unknown  reason,  this  does  not  work

            in  IE
                       pos  =  document.getElementById(el_id).style.backgroundPosition;
                       pos  =  pos.split('  ')[1];
                       pos  =  parseInt(pos,  10);
                       for(i  =  0; i  < posArr.length;  i++)  {
                            for(j  = 0;;j++)  {
                                 k = posArr[i] + (imgHeight  *  j);
                                 if(k  >  pos) {
                                       if((k -  pos)  <  posMin)  {
                                            posMin  =  k  -  pos;
                                            best  =  k;
                                            this.pos  =  posArr[i];  //update  the final  position  of  the  slot
                                       }
                                       break;

                                 }
                            }
                       }
                       best  +=  imgHeight  +  4;
                       bgPos  =  "0  "  + best  +  "px";
                       $(el).animate({
                            backgroundPosition:"("  + bgPos  + ")"
                       },  {
                                    duration:  200,
                            complete:  function()  {
                                 completed ++;
                            }
                       });
                 };
                 /**
                 * @method  reset
                 * Reset a  slot  to  initial state

                 */
                    Slot.prototype.reset  =  function()  {
                       var  el_id  =  $(this.el).attr('id');
                       $._spritely.instances[el_id].t  = 0;
                       $(this.el).css('background-position',  '0px  4px');
                       this.speed = 0;



                                                         -  414  -
   416   417   418   419   420   421   422   423   424   425   426