Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/02/2015, 18:48
Avatar de ferxxel
ferxxel
 
Fecha de Ingreso: septiembre-2013
Mensajes: 9
Antigüedad: 10 años, 7 meses
Puntos: 0
Pregunta Scrolling Suave en jQuery para mi web

Mi consulta es muy sencilla en realidad, necesito traducir una parte del código para poder adaptarla a mis necesidades. Eh aquí el código:
Código:
$(document).ready(function(){
  $('a[href*=#]').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
    && location.hostname == this.hostname) {
      var $target = $(this.hash);
      $target = $target.length && $target
      || $('[name=' + this.hash.slice(1) +']');
      if ($target.length) {
        var targetOffset = $target.offset().top;
        $('html,body')
        .stop().animate({scrollTop: targetOffset}, 1300, 'easeOutBounce');
       return false;
      }
    }
  });

	
});
Es un script para lograr un scrolling suave para mi web, el problema es que para funcionar debe usarse [href=""]
Código:
  $('a[href*=#]').click(function() { //<a href="#
Y lo que yo necesito es poder usarlo sobre un [onclick="location.href='#]. En definitiva lo que necesito es traducir esa primera línea para que funcione en mi plantilla.
Desde ya muchas gracias, espero puedan ayudarme :)