Frameworks| Hibernate| Struts| JSF| JavaFX| Ajax| Spring| DOJO| JDO| iBatis| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials:
 

Software Solutions and Services
 

 
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments
 
jQuery To Hide the Div 
 

In this JQuery tutorial we will develop a program that Hide of a Div

 

jQuery To Hide the Div

                         

In this JQuery tutorial we will develop a program that Hide of a Div

Steps to develop the Hide of a Div .

Step 1:

 

 

 

Create a new file (divdisappear.html) and add the following code into it:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Div Disappear</title>

<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">
$(document).ready(function(){

$(".divClass .deleteDiv").click(function(){
$(this).parents(".divClass").animate({ opacity: 'hide' }, "slow");
});

});
</script>

<style type="text/css">
body {
margin: 10px auto;
width: 470px;
}
h3 {
margin: 0;
padding: 0 0 .5em;
}
p {
margin: 0;
padding: 0 0 .3em;
}
.divClass {
background: #efefef;
padding: 20px 20px 20px;
position: relative;
border-top: solid 2px #000000;
}
.divClass .deleteDiv {
position: absolute;
top: 20px;
right: 20px;
cursor: pointer;
}
</style>
</head>

<body>
<div class="divClass">
<h3>Div 1</h3>
<p>Content 1.</p>
<img src="images/deletebttn.gif" alt="delete" class="deleteDiv" />
</div>
<div class="divClass">
<h3>Div 2</h3>
<p>Content 2.</p>

<img src="images/deletebttn.gif" alt="delete" class="deleteDiv" />
</div>
<div class="divClass">
<h3>Div 3</h3>
<p>Content 3.</p>
<img src="images/deletebttn.gif" alt="delete" class="deleteDiv" />
</div>

</body>

</html>


Program explanation:

The following code includes the jQuery JavaScript library file:

<script type="text/javascript" src="jquery.js"></script>

The Code

$(".divClass .deleteDiv").click(function(){

 This function works when generate the click event on the div

and having correponding style css.

divClass .deleteDiv {
position: absolute;
top: 20px;
right: 20px;
cursor: pointer;
}

and another function having two parameter opacity is visuality and "slow" working on class "divClass"

$(this).parents(".divClass").animate({ opacity: 'hide' }, "slow");

 After Click On the Delete 

Output :

 

Check online demo of the application

 

 

 

 

 

                         

» View all related tutorials
Related Tags: jquery c query image tutorial scroll ria this simple program to ram e il im dev first in m j

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Website Designing Services
 
Web Designing Packages From $150!
 
Website Designing Company Web Hosting
 
Website Designing Quotation
 
Search Tutorials:

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.