Based on HTML5 folding Card drop-down menu plugin Tutorial

Source: Internet
Author: User

First, the HTML structure
<div class= "Container" >

<div class= "Card-drop" >

<a class= ' Toggle ' href= "#" >

<i class= ' fa fa-suitcase ' ></i>

<span class= ' label-active ' > Mobile advertising platform </span>

</a>

<ul>

<li class= ' active ' >

<a data-label= "Everyting" href= "#" ><i class= ' fa fa-suitcase ' ></i> mobile advertising platform </a>

</li>

<li>

<a data-label= "Design" href= "#" ><i class= ' fa fa-magic ' ></i> keymob mobile advertising platform </a>

</li>

<li>

<a data-label= "Ui-ux" href= "#" ><i class= ' FA Fa-bolt ' ></i> Multi-League mobile advertising platform </a>

</li>

<li>

<a data-label= "Print" href= "#" ><i class= ' fa fa-tint ' ></i> Mango Mobile ads </a>

</li>

<li>

<a data-label= "Photography" href= "#" ><i class= ' fa fa-camera-retro ' ></i> have meter advertising platform </a>

</li>

<li>

<a data-label= "Photography" href= "#" ><i class= ' fa Fa-camera-retro ' ></i> Anwar Media </a>

</li>

</ul>

</div>

</div>


Second, JS structure
(function ($) {
var cards = $ ('. Card-drop '), Toggler = Cards.find ('. Toggle '), links = cards.find (' ul>li>a '), Li = links.parent (' li ') , Count = links.length, width = 100;
Li.each (function (i) {
$ (this). CSS (' Z-index ', count-i);
});
function setclosed () {
Li.each (function (index) {
$ (this). CSS (' top ', index * 4). css (' width ', width-index * 0.5 + '% '). CSS (' margin-left ', index * 0.25 + '% ');
});
Li.addclass (' closed ');
Toggler.removeclass (' active ');
}
Setclosed ();
Toggler.on (' MouseDown ', function () {
var $this = $ (this);
if ($this. is ('. Active ')) {
Setclosed ();
} else {
$this. addclass (' active ');
Li.removeclass (' closed ');
Li.each (function (index) {
$ (this). CSS (' Top ', * (index + 1)). CSS (' width ', ' 100% '). CSS (' margin-left ', ' 0px ');
});
}
});
Links.on (' click ', Function (e) {
var $this =$ (this), label = $this. Data (' label ');
icon= $this. Children (' I '). attr (' class ');
Li.removeclass (' active ');
if ($this. Parent (' Li '). Is (' active ')) {
$this. Parent (' Li '). Removeclass (' active ');
} else {
$this. Parent (' Li '). addclass (' active ');
}
Toggler.children (' span '). text (label);
Toggler.children (' i '). Removeclass (). addclass (icon);
Setclosed ();
E.preventdefault;
});
} (JQuery));

Keymob is the leading mobile advertising platform in China, which aggregates the mainstream mobile advertising platform at home and abroad, is a well-known mobile mobile advertising platform, and becomes the first choice of mobile advertising optimization for application developers.

Based on HTML5 folding Card drop-down menu plugin Tutorial

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.