Created
January 13, 2017 00:25
-
-
Save adhoch/996e600192acf09c76d247c5d8c3814d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="accordion-promo"> | |
<h2>Slip</h2> | |
<div class="accordion-promo-item"> | |
<div class="accordion-title"> | |
<span class="ico-icon-arrowDown rotateIcon "/> | |
<h3>The first announcement</h3> | |
</div> | |
<p class="accordion-description">Blah blittty blah blah! Blah blha habl </p> | |
</div> | |
<div class="accordion-promo-item"> | |
<div class="accordion-title"> | |
<span class="ico-icon-arrowDown "/> | |
<h3>The second annoucnement</h3> | |
</div> | |
<p class="accordion-description">oath, that I'm breaking now. We said we'd say it | |
was th </p> | |
</div> | |
<div class="accordion-promo-item"> | |
<div class="accordion-title"> | |
<span class="ico-icon-arrowDown "/> | |
<h3>The third announcement</h3> | |
</div> | |
<p class="accordion-description">You think water moves fast? You should see ice. It moves | |
like it has a mind. Like it knows it killed the world once and got a taste for murder. | |
After the avalanche, it took us a week to climb out. Now, I don't know exactly when | |
we turned on each other, but I know that seven of us survived the slide... and only five | |
made it out. Now we took an </p> | |
</div> | |
</div> | |
;(function($, undefined) { | |
function init() { | |
$('.accordion-title').on('accordion:open',function(event){ | |
var accordionTitle = $(this); | |
$(accordionTitle).next().slideDown(1000); | |
$(accordionTitle).find('.ico-icon-arrowDown').addClass('rotateIcon'); | |
}); | |
$('.accordion-title').on('accordion:close',function(event){ | |
var accordionTitles = $(this).closest('.accordion-promo'); | |
$(accordionTitles).find('.accordion-description').slideUp(1000); | |
if($(accordionTitles).find('.rotateIcon').length > 0){ | |
accordionTitles.find('.rotateIcon').removeClass('rotateIcon'); | |
}}); | |
$('.accordion-title').on('click', function(){ | |
var accordionTitle = $(this); | |
if (!accordionTitle.find('.ico-icon-arrowDown').hasClass('rotateIcon')){ | |
accordionTitle.trigger('accordion:close'); | |
accordionTitle.trigger('accordion:open'); | |
} | |
else { | |
accordionTitle.trigger('accordion:close'); | |
} | |
}) | |
} | |
$(init); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment