5 Replies - 8750 Views - Last Post: 05 August 2014 - 09:07 AM

#1 shinjie2554  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 28-August 09

DISABLE MOUSE SCROLLING

Posted 02 September 2010 - 08:00 PM

I want to disable scrolling using the mousewheel:

Ive used this code document.onmousewheel=stop;
but its not working...

on Firefox its still scrolling
on IE it says 'stop' is undefined

Any suggestions?
Is This A Good Question/Topic? 0
  • +

Replies To: DISABLE MOUSE SCROLLING

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9206
  • View blog
  • Posts: 34,589
  • Joined: 12-June 08

Re: DISABLE MOUSE SCROLLING

Posted 02 September 2010 - 08:40 PM

Curious question - *why* would you want to take control that far of a user's browser; something tantamount to handcuffing them on their own client?

How have you tried that 'on mouse wheel = stop' business?

Like this? http://www.tek-tips....=1262956&page=1
Was This Post Helpful? 0
  • +
  • -

#3 shinjie2554  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 28-August 09

Re: DISABLE MOUSE SCROLLING

Posted 02 September 2010 - 09:36 PM

Thanks I found these block of codes for disabling mouse wheel scroll

//-------------DISABLE MOUSE WHEEL SCROLL------------//
//--- for IE
document.attachEvent('onmousewheel', function(e){
if (!e) var e = window.event;
e.returnValue = false;
e.cancelBubble = true;
return false;
}, false);

//--- for Safari
document.addEventListener('mousewheel', function(e){
e.stopPropagation();
e.preventDefault();
e.cancelBubble = false;
return false;
}, false);

//--- for Opera
document.attachEvent('mousewheel', function(e){
if (!e) var e = window.event;
e.returnValue = false;
e.cancelBubble = true;
return false;
}, false);

//--- for Firefox

document.addEventListener('DOMMouseScroll', function(e){
e.stopPropagation();
e.preventDefault();
e.cancelBubble = false;
return false;
}, false);

//-----------END MOUSE WHEEL DISABLE CODES----------//
Was This Post Helpful? 0
  • +
  • -

#4 zapalac  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 05-August 14

Re: DISABLE MOUSE SCROLLING

Posted 05 August 2014 - 08:48 AM

View Postshinjie2554, on 02 September 2010 - 09:36 PM, said:

Thanks I found these block of codes for disabling mouse wheel scroll

//-------------DISABLE MOUSE WHEEL SCROLL------------//
//--- for IE
document.attachEvent('onmousewheel', function(e){
if (!e) var e = window.event;
e.returnValue = false;
e.cancelBubble = true;
return false;
}, false);

//--- for Safari
document.addEventListener('mousewheel', function(e){
e.stopPropagation();
e.preventDefault();
e.cancelBubble = false;
return false;
}, false);

//--- for Opera
document.attachEvent('mousewheel', function(e){
if (!e) var e = window.event;
e.returnValue = false;
e.cancelBubble = true;
return false;
}, false);

//--- for Firefox

document.addEventListener('DOMMouseScroll', function(e){
e.stopPropagation();
e.preventDefault();
e.cancelBubble = false;
return false;
}, false);

//-----------END MOUSE WHEEL DISABLE CODES----------//


What would i use for disabling mouse wheel scroll for Chrome? by the way awesome code, thanks
Was This Post Helpful? 0
  • +
  • -

#5 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9206
  • View blog
  • Posts: 34,589
  • Joined: 12-June 08

Re: DISABLE MOUSE SCROLLING

Posted 05 August 2014 - 08:51 AM

Please avoid neroposting.. the post was from four years ago..
Was This Post Helpful? 0
  • +
  • -

#6 zapalac  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 05-August 14

Re: DISABLE MOUSE SCROLLING

Posted 05 August 2014 - 09:07 AM

View Postmodi123_1, on 02 September 2010 - 08:40 PM, said:

Curious question - *why* would you want to take control that far of a user's browser; something tantamount to handcuffing them on their own client?

How have you tried that 'on mouse wheel = stop' business?

Like this? http://www.tek-tips....=1262956&page=1


I am building out an application for a style guide, the designer wants to restrict the client from scrolling to give them the true experience of their design and how it functions. This was an idea I gave until I can build out a scroll to div.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1