Problem: I am trying to display a map, but it does not load. I see an error in the JavaScript console:
Uncaught TypeError: Cannot read property 'top' of undefined
Solution: Fix JavaScript errors related to undefined elements by testing to see if those elements exist before performing calculations on them.
jQuery(document).ready(function($){ var $el = $('.bloc-localisation'); //record the elem so you don't crawl the DOM everytime // stop here if no bloc-localisation element exists on the current page if( $el.length == 0 ) { return; } var bottom = $el.offset().top + $el.outerHeight(true); // passing "true" will also include the top and bottom margin console.log('bottom bloc gauche : '+bottom);
Relevant Documentation:
http://api.jquery.com/
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
Ce sujet contient 4 réponses, a 2 voix.
Dernière mise à jour par Il y a 5 années et 10 mois.
Assisté par: Christian Cox.