Tema: Sobre jquery
Ver Mensaje Individual
  #5 (permalink)  
Antiguo 05/05/2011, 09:44
matucats
 
Fecha de Ingreso: mayo-2011
Mensajes: 8
Antigüedad: 13 años, 6 meses
Puntos: 0
Respuesta: Sobre jquery

("style")}},_showHideHotSpots:function(){var self=this,el=this.element,o=this.options;if(o.auto Scroll!=="always"){if(el.data("scrollableAreaWidth ")<=(el.data("scrollWrapper").innerWidth())){el.da ta("scrollingHotSpotLeft").hide();el.data("scrolli ngHotSpotRight").hide()}else if(el.data("scrollWrapper").scrollLeft()===0){el.d ata("scrollingHotSpotLeft").hide();el.data("scroll ingHotSpotRight").show();self._trigger("scrollLeft LimitReached");clearInterval(el.data("leftScrollIn terval"));el.data("leftScrollInterval",null)}else if(el.data("scrollableAreaWidth")<=(el.data("scrol lWrapper").innerWidth()+el.data("scrollWrapper").s crollLeft())){el.data("scrollingHotSpotLeft").show ();el.data("scrollingHotSpotRight").hide();self._t rigger("scrollRightLimitReached");clearInterval(el .data("rightScrollInterval"));el.data("rightScroll Interval",null)}else{el.data("scrollingHotSpotLeft ").show();el.data("scrollingHotSpotRight").show()} }else{el.data("scrollingHotSpotLeft").hide();el.da ta("scrollingHotSpotRight").hide()}},moveToElement :function(moveTo,elementNumber){var self=this,el=this.element,o=this.options,tempScrol lableAreaWidth=0,foundStartAtElement=false;switch( moveTo){case"first":el.data("scrollXPos",0);self._ trigger("movedToFirstElement");break;case"start":e l.data("scrollableArea").children(o.countOnlyClass ).each(function(){if((o.startAtElementId.length>0) &&(($(this).attr("id"))===o.startAtElementId)){el. data("startingPosition",tempScrollableAreaWidth);f oundStartAtElement=true}tempScrollableAreaWidth=te mpScrollableAreaWidth+$(this).outerWidth(true)});e l.data("scrollXPos",el.data("startingPosition"));s elf._trigger("movedToStartElement");break;case"las t":el.data("scrollXPos",el.data("scrollableAreaWid th"));self._trigger("movedToLastElement");break;ca se"number":if(!(isNaN(elementNumber))){el.data("sc rollableArea").children(o.countOnlyClass).each(fun ction(index){if(index===(elementNumber-1)){el.data("scrollXPos",tempScrollableAreaWidth)} tempScrollableAreaWidth=tempScrollableAreaWidth+$( this).outerWidth(true)})}self._trigger("movedToEle mentNumber",null,{"elementNumber":elementNumber}); break;default:break}el.data("scrollWrapper").scrol lLeft(el.data("scrollXPos"));self._showHideHotSpot s()},addContent:function(ajaxContentURL,addWhere){ var self=this,el=this.element;$.get(ajaxContentURL,fun ction(data){if(addWhere==="first"){el.data("scroll ableArea").children(":first").before(data)}else{el .data("scrollableArea").children(":last").after(da ta)}self.recalculateScrollableArea();self._showHid eHotSpots()})},replaceContent:function(ajaxContent URL){var self=this,el=this.element;el.data("scrollableArea" ).load(ajaxContentURL,function(){self.recalculateS crollableArea();self.moveToElement("first");self._ showHideHotSpots();el.data("startingPosition",0)}) },recalculateScrollableArea:function(){var tempScrollableAreaWidth=0,foundStartAtElement=fals e,o=this.options,el=this.element,self=this;el.data ("scrollableArea").children(o.countOnlyClass).each (function(){if((o.startAtElementId.length>0)&&(($( this).attr("id"))===o.startAtElementId)){el.data(" startingPosition",tempScrollableAreaWidth);foundSt artAtElement=true}tempScrollableAreaWidth=tempScro llableAreaWidth+$(this).outerWidth(true)});if(!(fo undStartAtElement)){el.data("startAtElementId","") }el.data("scrollableAreaWidth",tempScrollableAreaW idth);el.data("scrollableArea").width(el.data("scr ollableAreaWidth"));el.data("scrollWrapper").scrol lLeft(el.data("startingPosition"));el.data("scroll XPos",el.data("startingPosition"));if(!(el.data("i nitialAjaxContentLoaded"))){if((o.autoScroll.lengt h>0)&&!(o.hiddenOnStart)&&(o.ajaxContentURL.length >0)){self.startAutoScroll();el.data("initialAjaxCo ntentLoaded",true)}}},stopAutoScroll:function(){va r self=this,el=this.element;clearInterval(el.data("a utoScrollInterval"));el.data("autoScrollInterval", null);self._showHideHotSpots();self._trigger("auto ScrollStopped")},startAutoScroll:function(){var self=this,el=this.element,o=this.options;self._sho wHideHotSpots();clearInterval(el.data("autoScrollI nterval"));el.data("autoScrollInterval",null);self ._trigger("autoScrollStarted");el.data("autoScroll Interval",setInterval(function(){if(!(el.data("vis ible"))||(el.data("scrollableAreaWidth")<=(el.data ("scrollWrapper").innerWidth()))){clearInterval(el .data("autoScrollInterval"));el.data("autoScrollIn terval",null)}else{el.data("previousScrollLeft",el .data("scrollWrapper").scrollLeft());switch(o.auto ScrollDirection){case"right":el.data("scrollWrappe r").scrollLeft(el.data("scrollWrapper").scrollLeft ()+o.autoScrollStep);if(el.data("previousScrollLef t")===el.data("scrollWrapper").scrollLeft()){self. _trigger("autoScrollRightLimitReached");clearInter val(el.data("autoScrollInterval"));el.data("autoSc rollInterval",null);self._trigger("autoScrollInter valStopped")}break;case"left":el.data("scrollWrapp er").scrollLeft(el.data("scrollWrapper").scrollLef t()-o.autoScrollStep);if(el.data("previousScrollLeft") ===el.data("scrollWrapper").scrollLeft()){self._tr igger("autoScrollLeftLimitReached");clearInterval( el.data("autoScrollInterval"));el.data("autoScroll Interval",null);self._trigger("autoScrollIntervalS topped")}break;case"backandforth":if(el.data("ping PongDirection")==="right"){el.data("scrollWrapper" ).scrollLeft(el.data("scrollWrapper").scrollLeft() +(o.autoScrollStep))}else{el.data("scrollWrapper") .scrollLeft(el.data("scrollWrapper").scrollLeft()-(o.autoScrollStep))}if(el.data("previousScrollLeft ")===el.data("scrollWrapper").scrollLeft()){if(el. data("pingPongDirection")==="right"){el.data("ping PongDirection","left");self._trigger("autoScrollRi ghtLimitReached")}else{el.data("pingPongDirection" ,"right");self._trigger("autoScrollLeftLimitReache d")}}break;case"endlessloopright":if(el.data("getN extElementWidth")){if((o.startAtElementId.length>0 )&&(el.data("startAtElementHasNotPassed"))){el.dat a("swapAt",$("#"+o.startAtElementId).outerWidth(tr ue));el.data("startAtElementHasNotPassed",false)}e lse{el.data("swapAt",el.data("scrollableArea").chi ldren(":first").outerWidth(true))}el.data("getNext ElementWidth",false)}el.data("scrollWrapper").scro llLeft(el.data("scrollWrapper").scrollLeft()+o.aut oScrollStep);if(el.data("swapAt")<=el.data("scroll Wrapper").scrollLeft()){el.data("swappedElement",e l.data("scrollableArea").children(":first").detach ());el.data("scrollableArea").append(el.data("swap pedElement"));el.data("scrollWrapper").scrollLeft( el.data("scrollWrapper").scrollLeft()-el.data("swappedElement").outerWidth(true));el.dat a("getNextElementWidth",true)}break;case"endlesslo opleft":if(el.data("getNextElementWidth")){if((o.s tartAtElementId.length>0)&&(el.data("startAtElemen tHasNotPassed"))){el.data("swapAt",$("#"+o.startAt ElementId).outerWidth(true));el.data("startAtEleme ntHasNotPassed",false)}else{el.data("swapAt",el.da ta("scrollableArea").children(":first").outerWidth (true))}el.data("getNextElementWidth",false)}el.da ta("scrollWrapper").scrollLeft(el.data("scrollWrap per").scrollLeft()-o.autoScrollStep);if(el.data("scrollWrapper").scro llLeft()===0){el.data("swappedElement",el.data("sc rollableArea").children(":last").detach());el.data ("scrollableArea").prepend(el.data("swappedElement "));el.data("scrollWrapper").scrollLeft(el.data("s crollWrapper").scrollLeft()+el.data("swappedElemen t").outerWidth(true));el.data("getNextElementWidth ",true)}break;default:break}}},o.autoScrollInterva l))},restoreOriginalElements:function(){var self=this,el=this.element;el.data("scrollableArea" ).html(el.data("originalElements"));self.recalcula teScrollableArea();self.moveToElement("first")},sh ow:function(){var el=this.element;el.data("visible",true);el.show()} ,hide:function(){var el=this.element;el.data("visible",false);el.hide() },enable:function(){var el=this.element;el.data("enabled",true)},disable:f unction(){var el=this.element;clearInterval(el.data("autoScrollI nterval"));clearInterval(el.data("rightScrollInter val"));clearInterval(el.data("leftScrollInterval") );clearInterval(el.data("hideHotSpotBackgroundsInt erval"));el.data("enabled",false)},destroy:functio n(){var el=this.element;clearInterval(el.data("autoScrollI nterval"));clearInterval(el.data("rightScrollInter val"));clearInterval(el.data("leftScrollInterval") );clearInterval(el.data("hideHotSpotBackgroundsInt erval"));el.data("scrollingHotSpotRight").unbind(" mouseover");el.data("scrollingHotSpotRight").unbin d("mouseout");el.data("scrollingHotSpotRight").unb ind("mousedown");el.data("scrollingHotSpotLeft").u nbind("mouseover");el.data("scrollingHotSpotLeft") .unbind("mouseout");el.data("scrollingHotSpotLeft" ).unbind("mousedown");el.data("scrollableArea").ht ml(el.data("originalElements"));el.data("scrollabl eArea").removeAttr("style");el.data("scrollingHotS potRight").removeAttr("style");el.data("scrollingH otSpotLeft").removeAttr("style");el.data("scrollWr apper").scrollLeft(0);el.data("scrollingHotSpotLef t").removeClass("scrollingHotSpotLeftVisible");el. data("scrollingHotSpotRight").removeClass("scrolli ngHotSpotRightVisible");el.data("scrollingHotSpotR ight").hide();el.data("scrollingHotSpotLeft").hide ();$.Widget.prototype.destroy.apply(this,arguments )}})})(jQuery);