i using velocityjs, localscroll (which needs scrollto).
i have form hidden default. using anchor tag when clicked, show form.
html
<a href="#myform" class="button" id="show">show form</a> jquery
$('#show').click(function (event) { $('#myform') .velocity('slidedown', {'duration': 2000}) .velocity({'opacity': 1}, { 'complete': function () { $('#myform').localscroll({ 'target': 'body', 'duration': 2000, 'easing': 'swing', 'hash': false }); } }); }); what i'm running because don't have event.preventdefault stop default browser action of jumping target, page jumping form fading in.
i'd scroll page after form shown.
if use event.preventdefault(), page not scroll @ all. makes sense since @ point telling not anything.
instead of complicating yet library, use velocity's scroll command scroll required position, example:
//... complete: function (form) { $(form).velocity('scroll', { duration: 2000, easing: "swing" }); }
Comments
Post a Comment