0

I have some dependencies issue where jQuery i cant use but at the same time i need to make this work, any idea how you can do this without jQuery libraries.

$(document).ready(function() {

  function after2SecPreset1() {
    $('#sptouchscreen').hide();       
    return ;
  }

  function before2SecPreset1() {  
    console.log('before2secpreset1');
  }  

  var clickstart;
  var clickstop;
  $('#sptouchscreen').on('mousedown', function(e) {    
      clickstart = e.timeStamp;
  }).on('mouseup', function(e) {
      clickstop = e.timeStamp- clickstart;
      if(clickstop >= 2000) {
        after2SecPreset1();
      } else { 
        before2SecPreset1();
      }
  });
});

1 Answers1

1

For $(document).ready, add an event listener to document for the event "DOMContentLoaded".

For .hide(), set the style.display property of the element to "none".

For .on(), use .addEventListener instead.

Jackson
  • 9,188
  • 6
  • 52
  • 77