jQuery conflict with offset().top - ccm-toolbar issue

Permalink
I have been trying to implement a smooth page scroll from this code snippet I found on the internet:http://css-tricks.com/snippets/jquery/smooth-scrolling/...

This works perfectly. After setting this up, the ccm-toolbar does not show the Edit and Dashboard buttons. I've managed to trace the line that's causing this conflict. It's this line in the above code snippet that seems to be causing the conflict:
var targetOffset = $target.offset().top;


Does anyone know how to resolve this or is there another way to set the offset without creating a conflict?

BlueFractals
 
mhawke replied on at Permalink Reply
mhawke
I just added the smooth-scrolling code you mentioned in your post to a page on my test site and it works fine. The 'edit' and 'dashboard' buttons are still there and the page scrolls as designed. Have you added any css that might be targeting the ccm-toolbar.
BlueFractals replied on at Permalink Reply
BlueFractals
Your reply made me think and has led me to a solution.

It wasn't CSS though. I have a custom navigation bar that links to different anchors within a page. I have a jQuery script that dynamically creates anchor tags. For testing purpose, I ended up having more navigation items than the number of anchor tags they are actually linking to. This seemed to have a conflict with something (perhaps the jQuery offset or something else). Once I matched the total number of nav items with the number of anchors, the 'Edit' and 'Dashboard' buttons reappeared.

Thanks for your reply. :)