<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>jQuery &#8211; Extreme Web Designs</title>
	<atom:link href="https://theextremewebdesigns.com/blog/category/jquery-tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>https://theextremewebdesigns.com/blog</link>
	<description>Web Design and Web Development</description>
	<lastBuildDate>Wed, 01 Aug 2012 02:06:01 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.5</generator>
<site xmlns="com-wordpress:feed-additions:1">156673191</site>	<item>
		<title>jQuery Rollover Effects Examples</title>
		<link>https://theextremewebdesigns.com/blog/jquery-rollover-rollover-effects-rollovers-with-jquery-examples/</link>
					<comments>https://theextremewebdesigns.com/blog/jquery-rollover-rollover-effects-rollovers-with-jquery-examples/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 01 Aug 2012 02:06:01 +0000</pubDate>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jquery-demos]]></category>
		<category><![CDATA[jquery-rollover]]></category>
		<category><![CDATA[jquery-rollover-effects]]></category>
		<category><![CDATA[tutorials-jquery]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=1103</guid>

					<description><![CDATA[Have you been wondering how to achieve rollovers using jQuery? If yes, here&#8217;s a collection of rollovers in jQuery. Rollover effects for different html elements are discussed with examples. Read on to find out more. Examples of Rollover Effects using jQuery Before we move on with the examples, here&#8217;s the basic syntax for rollovers using [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Have you been wondering how to achieve <em><strong>rollovers using jQuery</strong></em>? If yes, here&#8217;s a collection of rollovers in jQuery. <strong>Rollover effects for different html elements</strong> are discussed with examples. Read on to find out more.<span id="more-1103"></span></p>
<h2>Examples of Rollover Effects using jQuery</h2>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=1103" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<p>Before we move on with the examples, here&#8217;s the basic syntax for rollovers using jQuery. You can apply the same principle to achieve rollovers for any html elements.</p>
<h3>Basic Syntax for jQuery Rollover using Element&#8217;s ID</h3>
<pre class="lang:js decode:true">$("#element_id").on('hover', function(e) {
//do this
});</pre>
<h3>Basic Syntax for jQuery Rollover using Element&#8217;s class</h3>
<pre class="lang:js decode:true">$(".element_class").on('hover', function(e) {
//do this
});</pre>
<h2>Back to jQuery Rollovers Examples</h2>
<p>Let&#8217;s assume that we have some html elements in our web page. Let&#8217;s look at some rollover examples for these elements. Here&#8217;s the full HTML source code. jQuery code for the rollovers will be provided as we go along.</p>
<h3>Example 1: Rollover Effect using .slideToggle() method in jQuery</h3>
<p>Toggle a Div when you rollover a hyperlink or when it is hovered upon. The hyperlink has a class of &#8220;link&#8221;. This has a rollover effect of &#8220;slow&#8221;. You can also use &#8220;fast&#8221; to speed up the toggle.</p>
<pre class="lang:js decode:true">$(document).ready(function() {

$("a.link").on('hover', function(e) {
$('#my_div').slideToggle('slow');
});

});</pre>
<h3>Example 2: Rollover effect using .hide() in jQuery</h3>
<p>Assuming that you have a div with ID &#8220;my_div&#8221;, you want to hide this Div from display when you rollover a hyperlink with class &#8220;link&#8221;.</p>
<pre class="lang:js decode:true">$(document).ready(function() {

$("a.link").on('hover', function(e) {
$('#my_div').hide();
});

});</pre>
<h3>Example 3: Rollover effect using .show() in jQuery</h3>
<p>If you have followed the Example 2 above, you will notice that when you rollover hyperlink, it hides the div. Now if you want to show that div, you can use the following jQuery code:</p>
<pre class="lang:js decode:true">$(document).ready(function() {

$("a.link").on('hover', function(e) {
$('#my_div').show();
});

});</pre>
<h3>Example 4: Image Rollover effect using jQuery (You must check it out!)</h3>
<p>Here is a <a title="jQuery Image Rollover effect with example" href="https://theextremewebdesigns.com/blog/tutorial-jquery-image-rollover/" target="_blank">jQuery Image Rollover effect with example</a></p>
<h3>Example 5: Multiple Rollover effects combined into a single effect using jQuery</h3>
<p>Let&#8217;s say that we have an input box inside a div. This div has ID &#8220;my_div&#8221;. When the page loads, we want to hide this input &amp; show it when we rollover the div. Here&#8217;s the HTML source code:</p>
<pre class="lang:xhtml decode:true">&lt;div id="my_div" class="my_class" title="My Div title"&gt;This is my div.
&lt;input type="text" name="name" id="name"&gt;
&lt;/div&gt;</pre>
<h4>Rollover Div to show input element using jQuery</h4>
<pre class="lang:js decode:true">$(document).ready(function() {

$('#name').hide();

$("#my_div").on('hover', function(e) {
$('#name').show();
});

});</pre>
<h4>Rollover Div to show hide the input element shown in the above process using jQuery</h4>
<pre class="lang:js decode:true">$("#my_div").mouseleave(function(e) {
$('#name').hide();
});</pre>
<h4>So the combined code for Rollover Div to show and hide the input element using jQuery is:</h4>
<pre class="lang:js decode:true">$(document).ready(function() {

$('#name').hide();

$("#my_div").on('hover', function(e) {
$('#name').show();
});

$("#my_div").mouseleave(function(e) {
$('#name').hide();
});

});</pre>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=1103" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<p>Now you might ask a question. Why use mouseleave instead of mouseout! Yes, there is a MouseOut event as well that you can use. But in our case, its not useful. Why? Well, for the scenario mentioned, here&#8217;s the main <strong>difference between mouseleave() and mouseout() in jQuery</strong>:</p>
<p><strong>MouseOut():</strong></p>
<p>When a child element of an element receives focus and we are performing an action on this child element, MouseOut() does not support it. That means when the mouse focus shifts from the parent element to the child element, it acts if the parent element has lost focus, even though you have a child element inside this parent element and the you have a mouseover this child element.</p>
<p><strong>MouseLeave();</strong></p>
<p>When we have a child element inside a parent element and we shift the mouse focus from the parent element to the child element, then the focus state of the parent element is considered to be existing unlike <strong>MouseOut()</strong> that loses focus. In other words, if you have a parent element and you hover the mouse on this, the hover event is triggered and maintained. When you hover over a child element of this parent element, the hover event that was just triggered, is remembered and retained.</p>
<p>So if you do <strong>use mouseout in our example instead of mouseleave</strong> and try out the code, you will notice that when you hover over the div, the input box will show up. But as soon as you hover over the input box and try to click in it to enter something, the input box disappears. And if you do use <strong>mouseleave</strong>, you will see that when you hover over &#8220;my_div&#8221;, it will show the input box and when you hover over the input box, this input box will remain in place and you will be able to click in it &amp; enter something. This input box will remain in view as long as you hover over the parent element or the child element or both. Whereas when you use <strong>MouseOut()</strong>, the input box will remain in view if and only if the parent div is hovered over at all times.</p>
<p>Hope the above comparison helps you in understanding the <strong>difference between mouseleave vs mouseout in jQuery</strong>.</p>
<h5>That&#8217;s it for now!</h5>
<p>Do you know of any other ways to <em><strong>make rollover effects in jQuery</strong></em>? Feel free to suggest by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/jquery-rollover-rollover-effects-rollovers-with-jquery-examples/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1103</post-id>	</item>
		<item>
		<title>jQuery Image Rollover Effect Example</title>
		<link>https://theextremewebdesigns.com/blog/tutorial-jquery-image-rollover/</link>
					<comments>https://theextremewebdesigns.com/blog/tutorial-jquery-image-rollover/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 30 May 2012 12:09:13 +0000</pubDate>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jquery-demos]]></category>
		<category><![CDATA[jquery-tips]]></category>
		<category><![CDATA[tutorials-jquery]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=689</guid>

					<description><![CDATA[If you have wondered if it is possible to create a  rollover for an image using jQuery, then the answer to it is: &#8220;Yes&#8221;! In this article by using a simple example, I am going to show you how to use  jQuery to create Image Rollover effect. Example of Image Roll Over Effect Using jQuery [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>If you have wondered if it is possible to create a  rollover for an image using jQuery, then the answer to it is: &#8220;Yes&#8221;! In this article by using a simple example, I am going to show you how to <em><strong>use  jQuery to create Image Rollover effect</strong></em>.<span id="more-689"></span></p>
<h2>Example of Image Roll Over Effect Using jQuery</h2>
<p>Let&#8217;s look at the demo first:</p>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=689" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<p><strong>Before Rollover:</strong></p>
<p><a href="https://theextremewebdesigns.com/blog/wp-content/uploads/2012/05/img_default.png" class="broken_link"><img decoding="async" class="aligncenter size-thumbnail wp-image-694" title="jQuery Image Rollover Effect - Before Rollover" alt="" src="https://theextremewebdesigns.com/blog/wp-content/uploads/2012/05/img_default-150x150.png" width="150" height="150" /></a></p>
<p><strong>After Rollover:</strong></p>
<p><a href="https://theextremewebdesigns.com/blog/wp-content/uploads/2012/05/img_roll.png" class="broken_link"><img decoding="async" class="aligncenter size-thumbnail wp-image-695" title="jQuery Image Rollover Effect - After Rollover" alt="" src="https://theextremewebdesigns.com/blog/wp-content/uploads/2012/05/img_roll-150x150.png" width="150" height="150" /></a></p>
<p>For the sake of example, let&#8217;s assume that you have a main &#8220;container&#8221; div that contains both the images i.e the image that needs to be shown by default and the roll over image as well.</p>
<h3>Example: Here is the complete source code</h3>
<pre class="lang:xhtml decode:true">&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;jQuery Image Rollover&lt;/title&gt;
&lt;script type="text/javascript" src="js/jquery-1.8.2.min.js"&gt;&lt;/script&gt;
&lt;style type="text/css"&gt;
.container {
width: 300px;
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;div class="container"&gt;
&lt;img src="1.jpg" width="300" height="300" class="img_default"&gt;
&lt;img src="2.jpg" width="300" height="300" class="img_rollover"&gt;
&lt;/div&gt;

&lt;script type="text/javascript" language="javascript" &gt;
$(document).ready(function(){

$('.img_rollover', $(this)).hide();

$('.container').hover(
function() {
$('.img_default', $(this)).hide();
$('.img_rollover', $(this)).show();
},
function() {
$('.img_default', $(this)).show();
$('.img_rollover', $(this)).hide();
}
);

});
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<h5>Simple, isn&#8217;t it?</h5>
<p>Do you know of any other ways to <em><strong>make Image rollover effect using jQuery</strong></em>? Feel free to suggest by commenting below.</p>
<p>P.S:  If you would like to find out how to achieve Image Rollover effect using CSS, then read my article on <a title="CSS Image Rollover with Example" href="https://theextremewebdesigns.com/blog/css-image-rollover-with-example/" target="_blank">CSS Image Rollover with Example</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/tutorial-jquery-image-rollover/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">689</post-id>	</item>
	</channel>
</rss>
