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

365
Views
¿Cómo obtengo la altura del documento usando unidades vh en jQuery?
$(window).scroll(function() { $scrollingDiv.css("display", (($(window).scrollTop() / $(document).height()) > 0.1) ? "block" : ""); });

¿Cómo puedo cambiar la unidad $(document).height()) > 0.1) a 100vh? No tengo mucha experiencia con jQuery.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

VH : Viewport Height es similar a $(window).height(); Fuente

Entonces puede verificar la condición if (windowHeight > 0.1) entonces

 $("body").height(windowHeight);

Código:

 $(document).ready(function() { var windowHeight = $(window).height(); if (windowHeight > 0.1) { alert("height is greater than 0.1"); $("body").height(windowHeight); } else { alert("height is less than 0.1"); } });

Enlace de código abierto: https://codepen.io/anon/pen/GWzVwO

over 4 years ago · Santiago Trujillo Report

0

Creo que la sintaxis correcta es $(selector).attr(attribute,value) Así que para su ejemplo específico $(document).attr('height','100vh')

Aquí hay un enlace que con suerte ayuda --> https://www.w3schools.com/jquery/html_attr.asp

over 4 years ago · Santiago Trujillo 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!