JavaScript scrollTop(); animation issues

I'm at a complete loss here. I'll provide what I currently have below, but for some reason, every iteration I try, something goes wrong...either the animation of scroll doesn't work but the other functions work, the animation of scroll does work but other functions do not work, all doesn't work, or all does work but animation flickers...

I tried to comment everything the best I could and have gotten to a point where if I use return false; either in 1 location or another, part of the entire function works, as mentioned above.

In a nut-shell, I'm trying to create an if/else statement that allows for scrolling animation as well as other functions to run all by clicking (1) single div. This div, aside from scrolling back to top with scroll animation, changes it's text AND should focus on a form element.

Any suggestions?

$('.sign_in').click(function () {

    // IMPORTANT - This scrolls the page back to top if user clicks on '.sign_in' div - May need fixed as it flickers for some reason...
    $('html, body').animate({
        scrollTop: 0
    }, 350); // NOTE: Set second number to '0' to eliminate flicker - however, doing this also eliminates scroll animation speed...

    // return false; // NOTE: Having 'return false;' stated here allows for smooth scrolling without flicker but disables the rest of the functions...

    // IMPORTANT - If/Else statement changes text on '.sign_in' div
    if ($(this).text() == 'REGISTER') {
        $(this).text('LOGIN');

        // IMPORTANT - This autofocuses on form element for 'Register' form
        $('.fname').focus();
    } else {
        $(this).text('REGISTER');

        // IMPORTANT - This autofocuses on form element for 'Login' form
        $('.uname').focus();
    }

    // IMPORTANT - This flips the form if user clicks on '.sign_in' div
    $('#formContainer').toggleClass('flipped');

    // return false; // NOTE: Having 'return false;' stated here allows all functions to run but causes flicker on scroll animation...
});
Answer:1

Hi i have a link tag that i am creating from javascript. now i want to append a parameters to that link just like below example.so that when the user clicks that button it should go to that url along ...

Hi i have a link tag that i am creating from javascript. now i want to append a parameters to that link just like below example.so that when the user clicks that button it should go to that url along ...

  1. creating link with hyperlink
  2. creating link in html
  3. creating link in linux
  4. creating link in excel
  5. creating link in word
  6. creating link in unix
  7. creating link in word document
  8. creating link in instagram bio
  9. creating link in pdf
  10. creating link to folder
  11. creating link in ubuntu
  12. creating link to pdf file
  13. creating link in windows
  14. creating link in markdown
  15. creating link in excel sheet
  16. creating link in instagram post
  17. creating link in dropbox
  18. creating link in pdf document
  19. creating link in php
  20. creating link in html without underline

I want to know if there is any benefit in passing off db or other async calls to a worker process or processes. Specifically I'm using heroku and postgres. I've read up a good bit on node.js and how ...

I want to know if there is any benefit in passing off db or other async calls to a worker process or processes. Specifically I'm using heroku and postgres. I've read up a good bit on node.js and how ...

  1. using background worker
  2. using backgroundworker c#
  3. use backgroundworker class
  4. using background worker in vb.net

I am making a website in Socket.io. But emit method not working in my code. I can't see any errors in my code. Here is my server code. var io = require("socket.io").listen(server); //Some external ...

I am making a website in Socket.io. But emit method not working in my code. I can't see any errors in my code. Here is my server code. var io = require("socket.io").listen(server); //Some external ...

  1. node socket emit
  2. node js socket emit
  3. node js socket emit example
  4. node socket.io emit
  5. node.js socket.emit callback
  6. node js socket emit error
  7. node js net socket emit
  8. node.js socket.io emit
  9. node.js socket.io emit json
  10. node js socket io emit callback
  11. node.js socket.broadcast.emit
  12. socket.emit node.js not working
  13. node.js socket.volatile.emit

I'm trying to play a video that I've CENC-encrypted using MP4box with these options: MP4Box -crypt drm_file_gpac_clear.xml BigBuckBunny.mp4 -out BigBuckBunny_cenc.mp4 Where the XML file specifies ...

I'm trying to play a video that I've CENC-encrypted using MP4box with these options: MP4Box -crypt drm_file_gpac_clear.xml BigBuckBunny.mp4 -out BigBuckBunny_cenc.mp4 Where the XML file specifies ...