I am venturing into parts of JavaScript and jQuery where I have never gone before and I am stuck.
I have a webpage divided vertically into two parts: the top part is always the height of the viewport, with a title/navigation bar (there will be some transitions here in the future) running across the middle of the top part.
This is what I am trying to accomplish: as I scroll down, the top part of the page and the title bar will move up and when the title bar hits the top of the viewport, I would like it to stick there.
I’ve tried to do this by switching CSS classes, but something is not working with the class switch. I have checked the JS values for the window height, the distance from the title bar to the top of the window, and the distance of the scroll. These values seem to be fine.
Yes, definitely. I have nothing against it per se, but I do find it gets in the way when trying to understand the basics of how JS works, which was what @WebMachine was aiming to do. (When I see demos of how to do something with JS and there’s a bit of jQuery in there, I always get disappointed, because it kind of obscures what’s going on.)
return false; in event handlers is one. Knowing what preventDefault and stopPropagation do is better. $(element).is(':checked') another when element.checked works.
But for the most part I agree, jQuery let’s you write the same code but better. Doesn’t prevent you from learning DOM updates, traversal, events etc. It can be a great aid to learning js.
Actually I am not a newcomer to programming and I have had experience with Javascript from years ago, just not that much with jQuery. For several years I have only used Javascript or jQuery when the need arises for specific tasks and haven’t had time to practice it in depth. One can’t have a deep understanding of every aspect of web development.
Having said that, I really think we are getting off topic here. Currently I am trying to figure out how to deal with scrolling issues. Thank you, @megazoid, for helping me with this first stage of what I am trying to accomplish.