Snap.js icon indicating copy to clipboard operation
Snap.js copied to clipboard

Toolbar Fixed

Open miguelmoya opened this issue 11 years ago • 3 comments

Hi,

Is possible fix #toolbar on top of page? Now have position absolute and I need fixed

anyone have same problem?

my english is not very well, sorry

miguelmoya avatar May 08 '13 16:05 miguelmoya

#toolbar { position: absolute; top: 0; right: 0; left: 0; width: auto; height: 50px; }

#content { position: absolute; top: 0; right: 0; left: 0; bottom: 0;

margin-top: 51px;
width: 100%;

overflow-y: auto;
overflow-x: hidden;
-webkit-overflow-scrolling: touch;

}

paulbarroso avatar May 25 '13 08:05 paulbarroso

I originally had my toolbar within .snap-content (the way that the demo is setup), then it drags/slides with the content, but that caused it to not be locked to the viewport, only locked within the scrollable .snap-content. To have a fixed toolbar you need to place the toolbar outside of .snap-content in the code and apply position: fixed to it.

Then you will have a fixed toolbar, but it won't animate/drag then. If you don't plan on using the drag functionality and only start SnapJS on button click, then animate the toolbar to slide (css transform) for the event hook, ex.- .on('start').

interactivellama avatar Jun 17 '13 17:06 interactivellama

Easy fix, simply add another instance of the Snap object, for example:

    var snapper = new Snap({
        element: document.getElementById('content')
    });
    var snapper2 = new Snap({
        element: document.getElementById('snap_head')
    });

ppoisson avatar Jul 29 '14 15:07 ppoisson