Ver Mensaje Individual
  #5 (permalink)  
Antiguo 25/04/2011, 17:12
Avatar de pao01
pao01
Colaborador
 
Fecha de Ingreso: junio-2008
Mensajes: 1.875
Antigüedad: 15 años, 10 meses
Puntos: 351
Respuesta: Campos personalizados desde páginas.

Continuación...

Código Javascript:
Ver original
  1. $carouselparts.hover(function(){ //onMouseover
  2.                 stepcarousel.stopautostep(config)
  3.                 config.autostep.hoverstate="over"
  4.             }, function(){ //onMouseout
  5.                 if (config.steptimer && config.autostep.hoverstate=="over" && config.autostep.status!="stopped"){
  6.                     config.resumeautostep=setTimeout(function(){
  7.                         stepcarousel.autorotate(config.galleryid)
  8.                         config.autostep.hoverstate="out"
  9.                     }, 1500)
  10.                 }
  11.             })
  12.             config.steptimer=setTimeout(function(){stepcarousel.autorotate(config.galleryid)}, config.autostep.pause) //automatically rotate Carousel Viewer
  13.         } //end enable auto stepping check
  14.         this.statusreport(config.galleryid)
  15.         config.oninit()
  16.         config.onslideaction(this)
  17.     },
  18.  
  19.     stepTo:function(galleryid, pindex){ /*User entered pindex starts at 1 for intuitiveness. Internally pindex still starts at 0 */
  20.         var config=stepcarousel.configholder[galleryid]
  21.         if (typeof config=="undefined"){
  22.             alert("There's an error with your set up of Carousel Viewer \""+galleryid+ "\"!")
  23.             return
  24.         }
  25.         stepcarousel.stopautostep(config)
  26.         var pindex=Math.min(pindex-1, config.paneloffsets.length-1)
  27.         var endpoint=config.paneloffsets[pindex]+(pindex==0? 0 : config.beltoffset)
  28.         if (config.panelbehavior.wraparound==false && config.defaultbuttons.enable==true){ //if carousel viewer should stop at first or last panel (instead of wrap back or forth)
  29.             this.fadebuttons(config, pindex)
  30.         }
  31.         config.$belt.animate({left: -endpoint+'px'}, config.panelbehavior.speed, function(){config.onslideaction(this)})
  32.         config.currentpanel=pindex
  33.         this.statusreport(galleryid)
  34.     },
  35.  
  36.     stepBy:function(galleryid, steps){ //isauto if defined indicates stepBy() is being called automatically
  37.         var config=stepcarousel.configholder[galleryid]
  38.         if (typeof config=="undefined"){
  39.             alert("There's an error with your set up of Carousel Viewer \""+galleryid+ "\"!")
  40.             return
  41.         }
  42.         stepcarousel.stopautostep(config)
  43.         var direction=(steps>0)? 'forward' : 'back' //If "steps" is negative, that means backwards
  44.         var pindex=config.currentpanel+steps //index of panel to stop at
  45.         if (config.panelbehavior.wraparound==false){ //if carousel viewer should stop at first or last panel (instead of wrap back or forth)
  46.             pindex=(direction=="back" && pindex<=0)? 0 : (direction=="forward")? Math.min(pindex, config.lastvisiblepanel) : pindex
  47.             if (config.defaultbuttons.enable==true){ //if default nav buttons are enabled, fade them in and out depending on if at start or end of carousel
  48.                 stepcarousel.fadebuttons(config, pindex)
  49.             }  
  50.         }
  51.         else{ //else, for normal stepBy behavior
  52.             if (pindex>config.lastvisiblepanel && direction=="forward"){
  53.                 //if destination pindex is greater than last visible panel, yet we're currently not at the end of the carousel yet
  54.                 pindex=(config.currentpanel<config.lastvisiblepanel)? config.lastvisiblepanel : 0
  55.             }
  56.             else if (pindex<0 && direction=="back"){
  57.                 //if destination pindex is less than 0, yet we're currently not at the beginning of the carousel yet
  58.                 pindex=(config.currentpanel>0)? 0 : config.lastvisiblepanel /*wrap around left*/
  59.             }
  60.         }
  61.         var endpoint=config.paneloffsets[pindex]+(pindex==0? 0 : config.beltoffset) //left distance for Belt DIV to travel to
  62.         if (pindex==0 && direction=='forward' || config.currentpanel==0 && direction=='back' && config.panelbehavior.wraparound==true){ //decide whether to apply "push pull" effect
  63.             config.$belt.animate({left: -config.paneloffsets[config.currentpanel]-(direction=='forward'? 100 : -30)+'px'}, 'normal', function(){
  64.                 config.$belt.animate({left: -endpoint+'px'}, config.panelbehavior.speed, function(){config.onslideaction(this)})
  65.             })
  66.         }
  67.         else
  68.             config.$belt.animate({left: -endpoint+'px'}, config.panelbehavior.speed, function(){config.onslideaction(this)})
  69.         config.currentpanel=pindex
  70.         this.statusreport(galleryid)
  71.     },
  72.  
  73.     autorotate:function(galleryid){
  74.         var config=stepcarousel.configholder[galleryid]
  75.         if (config.$gallery.attr('_ismouseover')!="yes"){
  76.             this.stepBy(galleryid, config.autostep.moveby)
  77.         }
  78.         config.steptimer=setTimeout(function(){stepcarousel.autorotate(galleryid)}, config.autostep.pause)
  79.     },
  80.  
  81.     statusreport:function(galleryid){
  82.         var config=stepcarousel.configholder[galleryid]
  83.         var startpoint=config.currentpanel //index of first visible panel
  84.         var visiblewidth=0
  85.         for (var endpoint=startpoint; endpoint<config.paneloffsets.length; endpoint++){ //index (endpoint) of last visible panel
  86.             visiblewidth+=config.panelwidths[endpoint]
  87.             if (visiblewidth>config.gallerywidth){
  88.                 break
  89.             }
  90.         }
  91.         startpoint+=1 //format startpoint for user friendiness
  92.         endpoint=(endpoint+1==startpoint)? startpoint : endpoint //If only one image visible on the screen and partially hidden, set endpoint to startpoint
  93.         var valuearray=[startpoint, endpoint, config.panelwidths.length]
  94.         for (var i=0; i<config.statusvars.length; i++){
  95.             window[config.statusvars[i]]=valuearray[i] //Define variable (with user specified name) and set to one of the status values
  96.             config.$statusobjs[i].text(valuearray[i]+" ") //Populate element on page with ID="user specified name" with one of the status values
  97.         }
  98.     },
  99.  
  100.     setup:function(config){
  101.         //Disable Step Gallery scrollbars ASAP dynamically (enabled for sake of users with JS disabled)
  102.         document.write('<style type="text/css">\n#'+config.galleryid+'{overflow: hidden;}\n</style>')
  103.         jQuery(document).ready(function($){
  104.             config.$gallery=$('#'+config.galleryid)
  105.             config.gallerywidth=config.$gallery.width()
  106.             config.offsets={left:stepcarousel.getoffset(config.$gallery.get(0), "offsetLeft"), top:stepcarousel.getoffset(config.$gallery.get(0), "offsetTop")}
  107.             config.$belt=config.$gallery.find('.'+config.beltclass) //Find Belt DIV that contains all the panels
  108.             config.$panels=config.$gallery.find('.'+config.panelclass) //Find Panel DIVs that each contain a slide
  109.             config.panelbehavior.wraparound=(config.autostep && config.autostep.enable)? true : config.panelbehavior.wraparound //if auto step enabled, set "wraparound" to true
  110.             config.onpanelclick=(typeof config.onpanelclick=="undefined")? function(target){} : config.onpanelclick //attach custom "onpanelclick" event handler
  111.             config.onslideaction=(typeof config.onslide=="undefined")? function(){} : function(beltobj){$(beltobj).stop(); config.onslide()} //attach custom "onslide" event handler
  112.             config.oninit=(typeof config.oninit=="undefined")? function(){} : config.oninit //attach custom "oninit" event handler
  113.             config.beltoffset=stepcarousel.getCSSValue(config.$belt.css('marginLeft')) //Find length of Belt DIV's left margin
  114.             config.statusvars=config.statusvars || []  //get variable names that will hold "start", "end", and "total" slides info
  115.             config.$statusobjs=[$('#'+config.statusvars[0]), $('#'+config.statusvars[1]), $('#'+config.statusvars[2])]
  116.             config.currentpanel=0
  117.             stepcarousel.configholder[config.galleryid]=config //store config parameter as a variable
  118.             if (config.contenttype[0]=="ajax" && typeof config.contenttype[1]!="undefined") //fetch ajax content?
  119.                 stepcarousel.getremotepanels($, config)
  120.             else
  121.                 stepcarousel.alignpanels($, config) //align panels and initialize gallery
  122.         }) //end document.ready
  123.         jQuery(window).bind('unload', function(){ //clean up
  124.             if (config.panelbehavior.persist){
  125.                 stepcarousel.setCookie(window[config.galleryid+"persist"], config.currentpanel)
  126.             }
  127.             jQuery.each(config, function(ai, oi){
  128.                 oi=null
  129.             })
  130.             config=null
  131.         })
  132.     }
  133. }
__________________
Entre más estrecha la mente, más grande la boca.- Ted Cook
Autosconarte-Blog