jQuery dropdown

Small Dropdown snippet:

with jQuery, all you need are just 3 lines of js and you have created a dropdown:

Demo:

Click Me

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.

You can achieve this with the following code, CSS + JS + HTML in 1 file


<style>
.roller {
display: none;
}
</style>

<script>
$(function() {
$(".rolldown").click( function(e) {
e.preventDefault();
$(".roller").slideToggle();
});
});
</script>

<a class="rolldown" href="#">More ></a>
<div class="roller">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</div>

Don’t forget to include jQuery in your website, or for WordPress change “$” to “jQuery” in the Javascript part.

Leave a Reply

Your email address will not be published.