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

157
Views
En mi sitio web, tengo un encabezado adhesivo y una sección de pestañas adhesivas

En mi sitio web, tengo un encabezado adhesivo y una sección de pestañas adhesivas. La sección particular de esas pestañas respectivas cuando desplazamos esa sección se esconde debajo del encabezado y las pestañas adhesivas, he usado Javascript para hacer esto. Quiero que las secciones aparezcan justo después de las pestañas adhesivas, que ahora se abren un poco debajo de las pestañas adhesivas.

Hay un problema con la altura del encabezado y las pestañas adhesivas.

Quiero el script en el que la sección se desplazará preguntándose las alturas del encabezado y las pestañas adhesivas, para que se vea correctamente.

A continuación se muestra el script que he utilizado.

 //script for sticky section like tabs starts // Click event offset = 0; $('#primary-navwrapper li a[href^="#"]').click(function(event) { // Prevent from default action to intitiate event.preventDefault(); //remove active from all anchor and add it to the clicked anchor $('#primary-navwrapper li a[href^="#"]').removeClass("active") $(this).addClass('active'); // The id of the section we want to go to var anchorId = $(this).attr('href'); // Our scroll target : the top position of the section that has the id referenced by our href var target = $(anchorId).offset().top - offset; console.log(target); $('html, body').stop().animate({ scrollTop: target }, 600, function () { window.location.hash = anchorId; }); return false; }); //check the pages when scroll event occurs $(window).scroll(function(){ // Get the current vertical position of the scroll bar position = $(this).scrollTop(); $('#primary-navwrapper li a[href^="#"]').each(function(){ var anchorId = $(this).attr('href'); var target = $(anchorId).offset().top - offset; // check if the document has crossed the page console.log(position,target); if(position>=target){ //remove active from all anchor and add it to the clicked anchor $('#primary-navwrapper li a[href^="#"]').removeClass("active") $(this).addClass('active'); } }) }) $(function(){ //set our scroll state after dom ready $(window).scroll(); }) //script for sticky section like tabs ends
about 4 years ago · Juan Pablo Isaza
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!