Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
JavaScript
$(document).ready(function(){
    // scroll elementos Menu
    var aboutme = $('#about').offset().top,
        project = $('#jobs').offset().top,
        contactme = $('#contact').offset().top;

    $('#btn-about').on('click', function(e){
        e.preventDefault();
        $('html, body').animate({
            scrollTop: 240
        }, 500);
    });

    $('#btn-jobs').on('click', function(e){
        e.preventDefault();
        $('html, body').animate({
            scrollTop: project
        }, 500);
    });

    $('#btn-contact').on('click', function(e){
        e.preventDefault();
        $('html, body').animate({
            scrollTop: contactme
        }, 500);
    });

});


What I have tried:

Due to the depreciation of JQuery. They would be so kind to help you migrate, I'm very clueless
Posted
Updated 18-May-21 22:58pm
Comments
Mehdi Gholam 24-Oct-18 14:19pm    
Check out https://zeptojs.com/

1 solution

You really should know what a libraries functions are before you use it. Many times in jQuery they are wrappers to existing which ALSO compensate for how browsers interpret various commands.
You should be able to lookup all of the methods you have in that block, and while you are there read up on what may be different if you use IE6 as opposed to chrome.

Here is a quick start for you:
JavaScript
document.addEventListener("DOMContentLoaded", function(event) {
  var aboutme = document.getElementById('about').offsetTop;
  var project = document.getElementById('jobs').offsetTop;
  var contactme = document.getElementById('contact').offsetTop;      

  // you can lookup the rest
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900