Cara Membuat Animated Collapsible DIV
Animated Collapsible merupakan sebuah collapses efek dengan menggunakan link togglers. Ini memungkinkan pengguna menampilkan konten secara manual, seperti melihat, membuka dan menutup konten lainnya sesuai permintaan. Efek ini banyak digunakan dan populer pada beberapa jaringan sosial / situs berkomentar.
Contoh:
Show Examples 1, 2, 3 | Hide Examples 1, 2, 3
Example 1 (individual):
Slide Down || Slide Up
Example 2 (individual):
Slide Down || Slide Up
Example 3 (individual):
Slide Down || Slide Up
Example 4 (part of group "pets"):
Slide Down || Slide Up
The cat (Felis catus), also known as the domestic cat or house cat to distinguish it from other felines, is a small carnivorous species of crepuscular mammal that is often valued by humans for its companionship and its ability to hunt vermin. It has been associated with humans for at least 9,500 years. A skilled predator, the cat is known to hunt over 1,000 species for food. It can be trained to obey simple commands.
Example 5 (part of group "pets"):Slide Down || Slide Up
The dog (Canis lupus familiaris) is a domesticated subspecies of the wolf, a mammal of the Canidae family of the order Carnivora. The term encompasses both feral and pet varieties and is also sometimes used to describe wild canids of other subspecies or species. The domestic dog has been one of the most widely kept working and companion animals in human history, as well as being a food source in some cultures.
Example 6 (part of group "pets"):Slide Down || Slide Up
Rabbits are ground dwellers that live in environments ranging from desert to tropical forest and wetland. Their natural geographic range encompasses the middle latitudes of the Western Hemisphere. In the Eastern Hemisphere rabbits are found in Europe, portions of Central and Southern Africa, the Indian subcontinent, Sumatra, and Japan.
Cara Memasang Animated Collapsible DIV
- Langkah Pertama:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script src='http://caprt3a.fileave.com/AnimatedCollapsibleDIV/animatedcollapse.js ' type='text/javascript'>
/***********************************************
* Animated Collapsible DIV v2.4- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
***********************************************/
</script>
<script type="text/javascript">
//<![CDATA[
animatedcollapse.addDiv('jason', 'fade=1,height=80px')
animatedcollapse.addDiv('kelly', 'fade=1,height=100px')
animatedcollapse.addDiv('michael', 'fade=1,height=120px')
animatedcollapse.addDiv('cat', 'fade=0,speed=400,group=pets')
animatedcollapse.addDiv('dog', 'fade=0,speed=400,group=pets,persist=1,hide=1')
animatedcollapse.addDiv('rabbit', 'fade=0,speed=400,group=pets,hide=1')
animatedcollapse.ontoggle=function($, divobj, state){ //fires each time a DIV is expanded/contracted
//$: Access to jQuery
//divobj: DOM reference to DIV being expanded/ collapsed. Use "divobj.id" to get its ID
//state: "block" or "none", depending on state
}
animatedcollapse.init()
//]]></script>
- Langkah Kedua:
<b><a href="javascript:animatedcollapse.show(['jason',%20'kelly',%20'michael'])">Show Examples 1, 2, 3</a> | <a href="javascript:animatedcollapse.hide(['jason',%20'kelly',%20'michael'])">Hide Examples 1, 2, 3</a></b>
<b>Example 1 (individual):</b>
<a href="javascript:animatedcollapse.toggle('jason')"><img border="0" src="http://img217.imageshack.us/img217/9224/toggle.jpg" /></a> <a href="javascript:animatedcollapse.show('jason')">Slide Down</a> || <a href="javascript:animatedcollapse.hide('jason')">Slide Up</a>
<div id="jason" style="background: none repeat scroll 0% 0% rgb(255, 255, 204); display: none; width: 300px;">
<b>Content inside DIV!</b>
<b>Note: Fade effect enabled. Height programmically defined. DIV hidden using inline CSS.</b>
</div>
<b>Example 2 (individual):</b>
<a href="javascript:animatedcollapse.toggle('kelly')"><img border="0" src="http://img217.imageshack.us/img217/9224/toggle.jpg" /></a> <a href="javascript:animatedcollapse.show('kelly')">Slide Down</a> || <a href="javascript:animatedcollapse.hide('kelly')">Slide Up</a>
<div id="kelly" style="background: none repeat scroll 0% 0% rgb(210, 251, 255); display: none; width: 300px;">
<b>Content inside DIV!</b>
<b>Note: Fade effect enabled. Height programmically defined. DIV hidden using inline CSS.</b>
</div>
<b>Example 3 (individual):</b>
<a href="javascript:animatedcollapse.toggle('michael')"><img border="0" src="http://img217.imageshack.us/img217/9224/toggle.jpg" /></a> <a href="javascript:animatedcollapse.show('michael')">Slide Down</a> || <a href="javascript:animatedcollapse.hide('michael')">Slide Up</a>
<div id="michael" style="background: none repeat scroll 0% 0% rgb(231, 255, 204); display: none; width: 300px;">
<b>Content inside DIV!</b>
<b>Note: Fade effect enabled. Height programmically defined. DIV hidden using inline CSS.</b>
</div>
<hr style="margin: 1em 0pt;" />
<b>Example 4 (part of group "pets"):</b>
<a data-closedimage="http://img849.imageshack.us/img849/971/expandx.jpg" data-openimage="http://img849.imageshack.us/img849/4082/collapsek.jpg" href="http://draft.blogger.com/post-create.g?blogID=7220479190136309909#" rel="toggle[cat]"><img border="0" src="http://img849.imageshack.us/img849/4082/collapsek.jpg" /></a> <a href="javascript:animatedcollapse.show('cat')">Slide Down</a> || <a href="javascript:animatedcollapse.hide('cat')">Slide Up</a>
<div id="cat" style="background: none repeat scroll 0% 0% rgb(189, 243, 129); width: 400px;">
The cat (Felis catus), also known as the domestic cat or house cat to distinguish it from other felines, is a small carnivorous species of crepuscular mammal that is often valued by humans for its companionship and its ability to hunt vermin. It has been associated with humans for at least 9,500 years. A skilled predator, the cat is known to hunt over 1,000 species for food. It can be trained to obey simple commands.</div>
<b>Example 5 (part of group "pets"):</b>
<a data-closedimage="http://img849.imageshack.us/img849/971/expandx.jpg" data-openimage="http://img849.imageshack.us/img849/4082/collapsek.jpg" href="http://draft.blogger.com/post-create.g?blogID=7220479190136309909#" rel="toggle[dog]"><img border="0" src="http://img849.imageshack.us/img849/4082/collapsek.jpg" /></a> <a href="javascript:animatedcollapse.show('dog')">Slide Down</a> || <a href="javascript:animatedcollapse.hide('dog')">Slide Up</a>
<div id="dog" style="background: none repeat scroll 0% 0% rgb(189, 243, 129); width: 400px;">
The dog (Canis lupus familiaris) is a domesticated subspecies of the wolf, a mammal of the Canidae family of the order Carnivora. The term encompasses both feral and pet varieties and is also sometimes used to describe wild canids of other subspecies or species. The domestic dog has been one of the most widely kept working and companion animals in human history, as well as being a food source in some cultures.</div>
<b>Example 6 (part of group "pets"):</b>
<a data-closedimage="http://img849.imageshack.us/img849/971/expandx.jpg" data-openimage="http://img849.imageshack.us/img849/4082/collapsek.jpg" href="http://draft.blogger.com/post-create.g?blogID=7220479190136309909#" rel="toggle[rabbit]"><img border="0" src="http://img849.imageshack.us/img849/4082/collapsek.jpg" /></a> <a href="javascript:animatedcollapse.show('rabbit')">Slide Down</a> || <a href="javascript:animatedcollapse.hide('rabbit')">Slide Up</a>
<div id="rabbit" style="background: none repeat scroll 0% 0% rgb(189, 243, 129); width: 400px;">
Rabbits are ground dwellers that live in environments ranging from desert to tropical forest and wetland. Their natural geographic range encompasses the middle latitudes of the Western Hemisphere. In the Eastern Hemisphere rabbits are found in Europe, portions of Central and Southern Africa, the Indian subcontinent, Sumatra, and Japan.</div>
<script type="text/javascript">
animatedcollapse.addDiv('jason', 'fade=1,height=80px')
animatedcollapse.addDiv('kelly', 'fade=1,height=100px')
animatedcollapse.addDiv('michael', 'fade=1,height=120px')
animatedcollapse.addDiv('cat', 'fade=0,speed=400,group=pets')
animatedcollapse.addDiv('dog', 'fade=0,speed=400,group=pets,persist=1,hide=1')
animatedcollapse.addDiv('rabbit', 'fade=0,speed=400,group=pets,hide=1')
animatedcollapse.ontoggle=function($, divobj, state){ //fires each time a DIV is expanded/contracted
//$: Access to jQuery
//divobj: DOM reference to DIV being expanded/ collapsed. Use "divobj.id" to get its ID
//state: "block" or "none", depending on state
}
animatedcollapse.init()
</script>
0 komentar:
Post a Comment
Catatan :
Untuk menyisipkan gambar kedalam komentar, gunakan tag : [img]URL_Gambar[/img]
atau <i rel="image">URL_Gambar</i>
Untuk Video Youtube : [youtube]URL_Video[/youtube]
atau <i rel="youtube">URL_Video</i>
Untuk "Kutipan", gunakan : [blockquote]Kutipan_Anda[/blockquote]
atau <b rel="quote">Kutipan_Anda</b>
Untuk menyisipkan Kode: [code]KODE[/code]
atau <i rel="code">KODE</i>
atau <i rel="pre">KODE</i>
Dan untuk menyisipkan smiles/ emoticon, lihat kode Emoticon