Onclick does not work on Firefox and IE

Asked

Viewed 139 times

1

This function does not work in firefox and IE:

In javascript:

function scrollTo() {
   var _offset = 90;
   $('html, body').animate({ scrollTop: $('#videoItem').offset().top - _offset }, 'slow');
   return false;
 }

In HTML:

<div class="videoItem"  onclick="javascript:scrollTo();"></div>

Can anyone help me? Thank you.

  • 1

    Rename the function, This name is from another native method of JS. http://www.w3schools.com/jsref/met_win_scrollto.asp. And see if it works

  • Thanks, it worked! Only in Chrome the screen gives a blink, know tell me why?

  • I think it might be some callback, checks that other functions are running

1 answer

1


You named the function with the same name as a native Javascript function. Rename the function that will work. Behold the MDN website

Browser other questions tagged

You are not signed in. Login or sign up in order to post.