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

121
Views
Javascript code broken in firefox browser only

I created a div C.

Its absolute position is setted to stay between the bottom margin of div A and top margin of div B.

Every div is a rectangle with same width.

C is a less hig than A and B. I use this solution in order do "hide" the seam between the two background image of A and B by covering the area where their margins meet one another. C has a backgorund image itself.

I manage these settings usign Javascript code insert in the right place of a WP theme Dashboard (Uncode theme, I didn't use Javascript pligin).

It's all right with all browser (I tried a LOT of browsers, mobile version too) but Firefox. I really can't understand why.

The code is:

var divTop = document.getElementsByClassName("A")[0].clientHeight;
var divWidth = document.getElementsByClassName("A")[0].clientWidth;
var Gap = document.getElementsByClassName("C")[0].clientHeight/2;
document.getElementsByClassName('C')[0].style.top=divTop-Gap + ".px";
document.getElementsByClassName('C')[0].style.width=divWidth + ".px";

U can verify by yourself: https://www.dolomitiinebike.it/

The website works well in every browser but opening it with firefox, everything is broken.

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

0

I solved installing a plug-in for adding Javascript and Jquery scripts (JS Inserter) and then I translate the code from Javascript to Jquery. I add the script infooter section. This solution is compatible with Firefox too.

var topHeight = jQuery('A').outerHeight();
var width = jQuery('A').outerWidth();
var gap = jQuery('C').outerHeight()/2;
jQuery('C').css({ top : topHeight - gap + "px" }); 
jQuery('C').css({ width : width  + "px" }); 
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!