Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function()
- {
- $(".box-img").click(function()
- {
- var itemid = '#div' + $(this).attr('target');
- //Show the element if nothing is shown.
- if ($('.active').length === 0) {
- $(itemid).slideDown();
- $(itemid).addClass('active');
- //Hide the element if it is shown.
- } else if (itemid == "#" + $('.active').attr('id')) {
- $('.active').slideUp();
- $(itemid).removeClass('active');
- //Otherwise, switch out the current element for the next one sequentially.
- } else {
- $('.active').slideUp(function () {
- $(this).removeClass('active');
- if ($(".targetDiv:animated").length === 0) {
- $(itemid).slideDown();
- $(itemid).addClass('active');
- }
- });
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement