Advertisement
raul3k

Rollup form

Aug 27th, 2014
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function rollUpForm()
  2. {
  3.     // Adding a input to the body beginning
  4.     $('<input>', {
  5.         id: 'inputRollControl',
  6.         type: 'text',
  7.         value: '1',
  8.         css: {
  9.             display: 'none'
  10.         }
  11.     }).prependTo('body');
  12.  
  13.     // Getting the new element
  14.     var inputControl = $('#inputRollControl');
  15.     // Removing the style to focus on element and the page will roll up
  16.     inputControl.removeAttr('style');
  17.     // Focusing the element
  18.     inputControl.focus();
  19.     // Hiding the element controll again
  20.     inputControl.attr('style', 'display: none');
  21. }
  22.  
  23.  
  24. // para ir para uma div
  25. $('html,body').animate({
  26.             scrollTop: $("#blocoZero").offset().top},
  27.         'slow');
  28.  
  29. // Topo
  30. $('html,body').animate({
  31.             scrollTop: 0},
  32.         'slow');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement