Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

418
Views
La barra de direcciones del navegador muestra #[objeto% 20Objeto] al hacer clic en la barra de menú

Descubrí que si hago clic en una de las secciones en la barra de menú, la barra de direcciones del navegador muestra #[object%20Object] . Pero no influyó en scroll-to-section .

Código parcial en la referencia:

 <li class="scroll-to-section"><a href="#top" class="active">Home</a></li> <li class="scroll-to-section"><a href="#services">Services</a></li> <li class="scroll-to-section"><a href="#about">About</a></li> <li class="scroll-to-section"><a href="#users">Evaluations</a></li> <li class="scroll-to-section"><a href="#newsletter">Newsletter</a></li>

Código JavaScript:

 $('.scroll-to-section a[href*=\\#]:not([href=\\#])').on('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 width = $(window).width(); if(width < 991) { $('.menu-trigger').removeClass('active'); $('.header-area .nav').slideUp(200); } $('html,body').animate({ scrollTop: (target.offset().top) + 1 }, 700); return false; } } });
 $(document).ready(function () { $(document).on("scroll", onScroll); //smoothscroll $('.scroll-to-section a[href^="#"]').on('click', function (e) { e.preventDefault(); $(document).off("scroll"); $('.scroll-to-section a').each(function () { $(this).removeClass('active'); }) $(this).addClass('active'); var target = this.hash; menu = target; target = $(this.hash); $('html, body').stop().animate({ scrollTop: (target.offset().top) + 1 }, 500, 'swing', function () { window.location.hash = target; $(document).on("scroll", onScroll); }); }); });

Intenté actualizar jQuery, pero no funcionó.

Página problemática

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

window.location.hash = target;

este es el problema. no puede establecer location.hash en un elemento. Debe ser un a name o una id en el documento. Una cuerda. No es un objeto.

about 4 years ago · Juan Pablo Isaza Report

0

Este problema fue causado por var target = this.hash , puede eliminar esta línea.

target se sobrescribe con un objeto jQuery que contiene el elemento de destino.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!