floating.js loading when not needed, causing errors
-
I could have missed some subtlety here, but it appears that floating.js is loaded on any singular page if the floating button bar option is “turned on”. This means it can be loaded on pages/post types that aren’t set (via the admin options) to display the buttons. In this case the buttons aren’t in the DOM, and both
socialize_floating.parent().offset().top
andoff.left
throw errors in floating.js, which is an issue for other js on the page.The quick fix would be to check that
jQuery('.socialize-floating')
has length > 0 in floating.js. A better solution would probably be to check that the post type is one on which the admin has chosen to display buttons before loading the js (to save unneeded http requests). Keeping the checks in floating.js wouldn’t be a bad idea, to be safe.Thanks-
- The topic ‘floating.js loading when not needed, causing errors’ is closed to new replies.