Sounds like you’ve either hidden JavaScript logs or specified that you only want to see Errors or Warnings. Open Chrome’s Developer Tools and go to the Console tab. At the bottom you want to ensure that JavaScript is ticked and also ensure that you have “All”, “Logs” or “Debug” selected.
In the image above I have JavaScript, Network, Logging, CSS and Other ticked and “All” selected.
Another potential problem could be that your $(window).scroll() function isn’t wrapped within a .ready() function (as documented here):
$(document).ready(function() {
$(window).scroll(function() {
…
});
});
When pasting your code into JSFiddle and giving some dummy content, your code works perfectly fine: JSFiddle demo.
Edit:
The question was edited. The new code given throws two errors:
Uncaught ReferenceError: fitHeight is not defined
Uncaught TypeError: Cannot read property ‘addEventListener’ of null
Because of this, the code stops execution prior to reaching any console.log call.
In my case, all console messages were not showing because I had left a string in the “filter” textbox.
Remove the filter it by clicking the X as shown: