Placing the script in the header.php in head section didnt work out. So, I tried this:
1. Added the contents of script to stickyheadergcm.js
2. Added this code
3. Added the css and body sections as you mentioned.
Although there is no change in what I described before, there is a curious effect.
If I let the default state of gcmbar to open, load the page and minimize the bar: the navigation bar gets stuck.
If I then reload the page with the gcmbar in a closed position (no changes in default state) and then open the bar, the navigation bar is not affected. It shows expected sticky behaviour.
It is just the collapsing of gcmbar and not the opening, that is causing this glitch.
And one more thing: Default state closed, still loads the bar in an open position.
I used mozilla for admin login and chrome/mozilla to test the front end.