<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: JavaScript disable mouse wheel</title>
	<atom:link href="http://www.stoimen.com/blog/2009/07/01/javascript-disable-mouse-wheel/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stoimen.com/blog/2009/07/01/javascript-disable-mouse-wheel/</link>
	<description>about web development</description>
	<lastBuildDate>Fri, 03 Feb 2012 22:35:35 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Adriaan</title>
		<link>http://www.stoimen.com/blog/2009/07/01/javascript-disable-mouse-wheel/comment-page-1/#comment-14428</link>
		<dc:creator>Adriaan</dc:creator>
		<pubDate>Tue, 13 Sep 2011 15:31:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.stoimen.com/blog/?p=635#comment-14428</guid>
		<description>It is really nice, I have adjusted the script since it was not working in IE, furthermore I combined it with this script:

http://solidlystated.com/scripting/javascript-disable-mouse-wheel/

Now this is my code, but it still won&#039;t work for IE, have I done something wrong?

/* IE7, IE8 */
			if(document.attachEvent){
				 document.attachEvent(&#039;onmousewheel&#039;, stopWheel, false);
			}
			
			/* Chrome, Safari, Firefox */
			else if(document.addEventListener){ 
			    document.addEventListener(&#039;DOMMouseScroll&#039;, stopWheel, false);
			}
			 
			function stopWheel(e){
				/* IE7, IE8, Chrome, Safari */
			    if(!e) { 
				    var e = window.event; 
				}
				
				/* Chrome, Safari, Firefox */
			    if(e.preventDefault) { 
					e.stopPropagation();
				    e.preventDefault();
				    e.cancelBubble = false; 
				}
				
				/* IE7, IE8 */
			   	e.returnValue = false;
				e.cancelBubble = true;
				return false;
			}</description>
		<content:encoded><![CDATA[<p>It is really nice, I have adjusted the script since it was not working in IE, furthermore I combined it with this script:</p>
<p><a href="http://solidlystated.com/scripting/javascript-disable-mouse-wheel/" rel="nofollow">http://solidlystated.com/scripting/javascript-disable-mouse-wheel/</a></p>
<p>Now this is my code, but it still won&#8217;t work for IE, have I done something wrong?</p>
<p>/* IE7, IE8 */<br />
			if(document.attachEvent){<br />
				 document.attachEvent(&#8216;onmousewheel&#8217;, stopWheel, false);<br />
			}</p>
<p>			/* Chrome, Safari, Firefox */<br />
			else if(document.addEventListener){<br />
			    document.addEventListener(&#8216;DOMMouseScroll&#8217;, stopWheel, false);<br />
			}</p>
<p>			function stopWheel(e){<br />
				/* IE7, IE8, Chrome, Safari */<br />
			    if(!e) {<br />
				    var e = window.event;<br />
				}</p>
<p>				/* Chrome, Safari, Firefox */<br />
			    if(e.preventDefault) {<br />
					e.stopPropagation();<br />
				    e.preventDefault();<br />
				    e.cancelBubble = false;<br />
				}</p>
<p>				/* IE7, IE8 */<br />
			   	e.returnValue = false;<br />
				e.cancelBubble = true;<br />
				return false;<br />
			}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Furkan Tunalı</title>
		<link>http://www.stoimen.com/blog/2009/07/01/javascript-disable-mouse-wheel/comment-page-1/#comment-14175</link>
		<dc:creator>Furkan Tunalı</dc:creator>
		<pubDate>Wed, 02 Feb 2011 01:06:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.stoimen.com/blog/?p=635#comment-14175</guid>
		<description>Thanks for your nice article, it helped a lot.

In addition, for the people who wants to check if function defined they can use typeof, ie: &lt;pre lang=&quot;javascript&quot;&gt;if(typeof document.attachEvent == &#039;function&#039;)&lt;/pre&gt;

&lt;strong&gt;@Akkara,&lt;/strong&gt;
e object will give you the scroll x,y nodes. Comment out a console.log from the code below for your browser spesific function, you&#039;ll see what your browser will gives you. On chrome e.offsetX, e.offsetY, e.pageX, e.pageY, e.screenX, e.screenY etc..

&lt;pre lang=&quot;javascript&quot;&gt;
	if(typeof document.attachEvent == &#039;function&#039;) { //IE
		document.attachEvent(&#039;onmousewheel&#039;, function(e){
			//console.log(e);
		     if (!e) var e = window.event;
		     e.returnValue = false;
		     e.cancelBubble = true;
		     return false;
		}, false);
	} else if(typeof document.addEventListener == &#039;function&#039;) { //WEBKIT
		document.addEventListener(&#039;mousewheel&#039;, function(e){
			//console.log(e);
		    e.stopPropagation();
		    e.preventDefault();
		    e.cancelBubble = false;
		    return false;
		}, false);
	} else if(typeof document.attachEvent == &#039;function&#039;) { //OPERA
		document.attachEvent(&#039;mousewheel&#039;, function(e){
			//console.log(e);
		    if (!e) var e = window.event;
		    e.returnValue = false;
		    e.cancelBubble = true;
		    return false;
		}, false);
	} else if(typeof document.addEventListener == &#039;function&#039;) { //GECKO
		document.addEventListener(&#039;DOMMouseScroll&#039;, function(e){
			//console.log(e);
		    e.stopPropagation();
		    e.preventDefault();
		    e.cancelBubble = false;
		    return false;
		}, false);
	}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Thanks for your nice article, it helped a lot.</p>
<p>In addition, for the people who wants to check if function defined they can use typeof, ie:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> document.<span style="color: #660066;">attachEvent</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">'function'</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p><strong>@Akkara,</strong><br />
e object will give you the scroll x,y nodes. Comment out a console.log from the code below for your browser spesific function, you&#8217;ll see what your browser will gives you. On chrome e.offsetX, e.offsetY, e.pageX, e.pageY, e.screenX, e.screenY etc..</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> document.<span style="color: #660066;">attachEvent</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">'function'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">//IE</span>
		document.<span style="color: #660066;">attachEvent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'onmousewheel'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #006600; font-style: italic;">//console.log(e);</span>
		     <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>e<span style="color: #009900;">&#41;</span> <span style="color: #003366; font-weight: bold;">var</span> e <span style="color: #339933;">=</span> window.<span style="color: #660066;">event</span><span style="color: #339933;">;</span>
		     e.<span style="color: #660066;">returnValue</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		     e.<span style="color: #660066;">cancelBubble</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		     <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> document.<span style="color: #660066;">addEventListener</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">'function'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">//WEBKIT</span>
		document.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'mousewheel'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #006600; font-style: italic;">//console.log(e);</span>
		    e.<span style="color: #660066;">stopPropagation</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    e.<span style="color: #660066;">preventDefault</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    e.<span style="color: #660066;">cancelBubble</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> document.<span style="color: #660066;">attachEvent</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">'function'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">//OPERA</span>
		document.<span style="color: #660066;">attachEvent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'mousewheel'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #006600; font-style: italic;">//console.log(e);</span>
		    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>e<span style="color: #009900;">&#41;</span> <span style="color: #003366; font-weight: bold;">var</span> e <span style="color: #339933;">=</span> window.<span style="color: #660066;">event</span><span style="color: #339933;">;</span>
		    e.<span style="color: #660066;">returnValue</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		    e.<span style="color: #660066;">cancelBubble</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> document.<span style="color: #660066;">addEventListener</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">'function'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">//GECKO</span>
		document.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'DOMMouseScroll'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #006600; font-style: italic;">//console.log(e);</span>
		    e.<span style="color: #660066;">stopPropagation</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    e.<span style="color: #660066;">preventDefault</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    e.<span style="color: #660066;">cancelBubble</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: Akkara</title>
		<link>http://www.stoimen.com/blog/2009/07/01/javascript-disable-mouse-wheel/comment-page-1/#comment-12980</link>
		<dc:creator>Akkara</dc:creator>
		<pubDate>Thu, 06 May 2010 08:12:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.stoimen.com/blog/?p=635#comment-12980</guid>
		<description>Thank you. So how do we get the wheel value?</description>
		<content:encoded><![CDATA[<p>Thank you. So how do we get the wheel value?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stoimen</title>
		<link>http://www.stoimen.com/blog/2009/07/01/javascript-disable-mouse-wheel/comment-page-1/#comment-12462</link>
		<dc:creator>Stoimen</dc:creator>
		<pubDate>Fri, 26 Feb 2010 08:17:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.stoimen.com/blog/?p=635#comment-12462</guid>
		<description>Well this code can simply be wrapped into a jQuery shell, which was my case. 

greetings,
stoimen</description>
		<content:encoded><![CDATA[<p>Well this code can simply be wrapped into a jQuery shell, which was my case. </p>
<p>greetings,<br />
stoimen</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Miro Zografski</title>
		<link>http://www.stoimen.com/blog/2009/07/01/javascript-disable-mouse-wheel/comment-page-1/#comment-12461</link>
		<dc:creator>Miro Zografski</dc:creator>
		<pubDate>Fri, 26 Feb 2010 08:02:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.stoimen.com/blog/?p=635#comment-12461</guid>
		<description>You really should set examples in jQuery as well.</description>
		<content:encoded><![CDATA[<p>You really should set examples in jQuery as well.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

