At the bottom of the body? Are you serious??
See original GitHub issueI’ve just replaced lightbox 2.7.1 with 2.8.2. To start with, I would expect it to be a 100% backward-compatible drop-in replacement that would work out of the box where the previous version used to work, otherwise you should call it 3.x.
Then I found out what the breaking change is:
Include the Javascript at the bottom of your page before the closing
</body>
tag:
The old version used to work by placing it in the <head>
. Besides the fact that a decently designed script would work either way, having it in <head>
is far more elegant and it is the way most modern frameworks and libraries work.
You are going backwards, making things worse rather than better. I’m definitely done with Lightbox.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:22
- Comments:12 (3 by maintainers)
Top Results From Across the Web
Low blood pressure (hypotension) - Symptoms and causes
If you have symptoms of extreme low blood pressure (hypotension) or ... The second (bottom) number is the pressure in the arteries when...
Read more >Which numbers mean high blood pressure? - HealthPartners
The bottom number is called diastolic blood pressure. It tells you what your blood pressure is when your heart is at rest between...
Read more >Itchy bottom causes & treatments - Illnesses & conditions
Itchy bottom is characterised by a strong urge to scratch the skin around your anus. Learn about itchy bottom causes and treatments.
Read more >Body Type - Penn Medicine
Abdominal obesity is probably the most dangerous of all, and apple body shape is considered at the highest risk for health issues compared...
Read more >Spleen problems and spleen removal - NHS
Surgery is only necessary if the enlarged spleen is causing serious complications or the cause cannot be found. Surgery to remove the spleen....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Of course, since as you say, you were already putting the script at the end of body.
Good for you, but a lot of other people prefer scripts in the
<head>
.Actually I’ve never seen a library before that requires you to put it in a specific place.
This is not just about backwards compatibility (which is of course a big deal in itself). Not working unless the library is placed at the end of the body is a bug, whether it affects you in particular or not.
Why would you want to put a non-critical script in the header? it goes against SEO practices, and causes load-blocking so your page is slower. The only benefit to keeping it in the head, other than looking pretty, would be if you are using the defer and async attributes, at which point you would have to wrap it in an on-load function anyway. Which is the entire point of putting it in the body, and at the end. So that it is loaded last when the document is ready. And at the least, your page visibly loads before it starts downloading the addon resource!
I’m sorry but I had to comment, this doesn’t make any sense to me. There are far more critical issues at hand. Not to be dismissive or rude, that’s not my intent - i apologize in advance if it came across that way. I just don’t understand why anyone would want this!! I mean I’ve literally written code to regex process php output in order to get hardcoded head scripts out of there into the body in wordpress due to poor design practices… I can’t imagine actually wanting to put something non critical into it!
We overuse the head these days, and it really should only have minimal css and meta tags, and only ONLY super critical resources, like a raw dump of jquery (so its available instantly, and compressed into the html output). The head should be redefined as “only what is needed to load the above-the-fold page goes here”, where the word “load” has complete separation from “display” when it comes to body contents.
Especially when google, bing, etc require your page to load under 1 second to get a good ranking. Async & footer loading all the way man, hands down.