Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
C0D4669026y(Function(){ // this waits for the document to be ready
$(document).ready // is fucking useless inside the other one
<script> // at bottom of page is waiting for the dom to be ready anyway
Like wtf, how ready does this DOM need to be 😂 -
Fexell6566y@norman70688 The if statement is not needed at all. You can provide logic as a second parameter. Like this: $(".some-div").css({color: #fff}, $(window).scrollTop > 100);
-
Fexell6566y@norman70688 My bad. Confused css with toggleclass there. Still, using a class toggle would be much more efficient.
-
unknown18356yI prefer using a toggle class as well. It's more lightweight and it's more clean/stable when you need some transitions.
Related Rants
We have a custom made CMS, where you can use templates (previous designs). Most of the time I see these templates with Javascript/jQuery that looks like this...
Edit: There is an extra $ in front of the first (function($). So like this: $(function($)
rant
jquery
i think document is ready now
javascript