Accordion using Jquery


In this article I'm trying to explain how to work with accordion pane using Jquery with simple and easy way. We all of them know that using Jquery we can achieve our goal with simplest code. Here, I'm trying to explain the accordion with simple code part.

Accordion using Jquery:



In this article I'm trying to explain how to work with accordion pane using Jquery with simple and easy way. We all of them know that using Jquery we can achieve our goal with simplest code. Here, I'm trying to explain the accordion with simple code part.

Source Code:



Here, this is the most important code part to achieve this.


<script>
$(function () {
$("#accordion").accordion();
});
</script>




The source code becomes like below.


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Accordian.aspx.cs" Inherits="Accordian" %>

<!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 runat="server">
<title>Accordian Demo</title>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<script>
$(function () {
$("#accordion").accordion();
});
</script>

</head>
<body>
<form id="form1" runat="server">
<div id="accordion">
<h2>1)What is Abstract Class and when we use that?</h2>
<div>
<p>A)Abstraction is the mechanism to show only relevant data to the user. At least one method with Abstract keyword inside abstract class.
In base class we just define the method with abstract keyword we can implement that in derived class using override keyword.</p>
</div>
<h2>2)What is virtual class and when we use that?</h2>
<div>
<p>A)Virtual method is used to redefine the base class methods in derived class. When we use Virtual methods means, in base we perform some action but in derived we need to perform more actions apart from that in that case we go for virtual.
</p>
</div>
<h2>3) What is interface class and when we use that, why C# won't support multiple inheritances</h2>
<div>
<p>A)An interface is a set of related functions that must be implemented in a derived class. Members of an interface are implicitly public and abstract. Interfaces are similar to abstract classes. First, both types must be inherited; second, you cannot create an instance of either. Although there are several differences as in the following;
An Abstract class can contain some implementations but an interface can't.
An Interface can only inherit other interfaces but abstract classes can inherit from other classes and interfaces.
An Abstract class can contain constructors and destructors but an interface can't.
An Abstract class contains fields but interfaces don't.
So the question is, which of these to choose? Select interfaces because with an interface, the derived type still can inherit from another type and interfaces are more straightforward than abstract classes.</p>
</div>
<h2>4)What is static class?</h2>
<div>
<p>A)A static class and Non-Static classes both are in same in structure but the difference is a static Class can't be instantiated; you can directly call the methods using that static class name itself. A static class must contain only static members.</p>
</div>

</div>
</form>
</body>
</html>

Conclusion:


I hope this article will help you to perform the Accordion pane with simplest code part using Jquery. I hope all of them are enjoyed with this.


Article by naveensanagasetti
I hope you enjoyed to read my article, If you have any queries out of this then please post your comments.

Follow naveensanagasetti or read 139 articles authored by naveensanagasetti

Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: