3

I have a small jQuery function below. It basically works by clicking on the element #hover-trigger, whether is be a link or image. This then makes a centralized div element appear centrally on screen, in this case #hover-content.

What I am wondering is, what function can I add onto the end of this one to make the div disappear again when a certain element is clicked?

$(document).ready(function()
{
    $('#hover-trigger').click(function()
    {
        $(this).next('#hover-content').slideToggle();
        $(this).toggleClass('active');                  

        if ($(this).hasClass('active')) 
            $(this).find('span').html('▲')
        else 
            $(this).find('span').html('▼')
    })
});
1
  • 2
    Retagging, there is no relevance to PHP in this question Commented Mar 18, 2013 at 1:15

2 Answers 2

1

whatever element you want to click on, tell it to hide the div.

$("#clickMe").click(function(){

$("#divToHide").hide();
});
Sign up to request clarification or add additional context in comments.

Comments

0

Try:

$('#hide-trigger').click(function(){
    $('.avtive').slideToggle();
    $('.active').toggleClass('active');
});

or am I missing something?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.