Foros del Web » Programando para Internet » Javascript »

Acceso a través de anchor link javascript

Estas en el tema de Acceso a través de anchor link javascript en el foro de Javascript en Foros del Web. Hola, veréis, tengo un blog de wordpress en el cual estoy utilizando un plugin llamado cTabs. Este plugin lo que hace es mostrar el contenido ...
  #1 (permalink)  
Antiguo 03/10/2011, 04:28
 
Fecha de Ingreso: agosto-2006
Mensajes: 5
Antigüedad: 17 años, 7 meses
Puntos: 0
Acceso a través de anchor link javascript

Hola, veréis, tengo un blog de wordpress en el cual estoy utilizando un plugin llamado cTabs. Este plugin lo que hace es mostrar el contenido en un formato de pestaña. El caso, es que me gustaría incluir desde un enlace enlace a una pestaña en concreto, pero siempre me muestra la principal.

Os pongo el enlace:

http://www.dragon-base.com/productos/consolas/hydra-space/

Si os fijáis, hay varias pestañas: Funcionalidades, Características, Opciones, etc....

Cuando pulsas sobre características, el enlace sería:

http://www.dragon-base.com/productos/consolas/hydra-space/#Caracteristicas

Pero de esta forma, si pego el enlace, no funciona y sigue mostrando la primera pestaña, que es Funcionalidades.

No tengo mucha idea de javascript, y el autor de este plugin no da señales de vida desde hace meses.

El código de javascript es este:

Código:
(function($) {

    $.cTabs = function(el, options) {
    
        var base = this;
        base.$el = $(el);
        base.$nav = base.$el.find(".nav");
                
        base.init = function() {
        
            base.options = $.extend({},$.cTabs.defaultOptions, options);
            
            // Accessible hiding fix
            $(".hide").css({
                "position": "relative",
                "top": 0,
                "left": 0,
                "display": "none"
            }); 
            
            base.$nav.delegate("li > a", "click", function() {
            
                // Figure out current list via CSS class
                var curList = base.$el.find("a.current").attr("href").substring(1),
                
                // List moving to
                    $newList = $(this),
                    
                // Figure out ID of new list
                    listID = $newList.attr("href").substring(1),
                
                // Set outer wrapper height to (static) height of current inner list
                    $allListWrap = base.$el.find(".list-wrap"),
                    curListHeight = $allListWrap.height();
                $allListWrap.height(curListHeight);
                                        
                if ((listID != curList) && ( base.$el.find(":animated").length == 0)) {
                                            
                    // Fade out current list
                    base.$el.find("#"+curList).fadeOut(base.options.speed, function() {
                        
                        // Fade in new list on callback
                        base.$el.find("#"+listID).fadeIn(base.options.speed);
                        
                        // Adjust outer wrapper to fit new list snuggly
                        var newHeight = base.$el.find("#"+listID).height();
                        $allListWrap.animate({
                            height: newHeight
                        });
                        
                        // Remove highlighting - Add to just-clicked tab
                        base.$el.find(".nav li a").removeClass("current");
                        $newList.addClass("current");
                            
                    });
                    
                }   
                
                // Don't behave like a regular link
                // Stop propegation and bubbling
                return false;
            });
            
        };
        base.init();
    };
    
    $.cTabs.defaultOptions = {
        "speed": 300
    };
    
    $.fn.cTabs = function(options) {
        return this.each(function() {
            (new $.cTabs(this, options));
        });
    };
    
})(jQuery);
Muchas gracias por la ayuda

Etiquetas: funcion, link
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 13:19.