2

http://jsfiddle.net/rusticblonde/zg4JG/26/

$( "#infodiv" ).click(function() {
   $( "#div2" ).slideToggle( "slow", function() {

 });
$("#infodiv").click(function() {
    $("#div2 #div1").css("webkit-filter", "none")
 });
});

Hi there,

ive done a fiddle where on click i want to on click display a box with information, and change the colour back to its original. I seem to have got the click box working, however it doesnt change back to its original colour.

I currently have this on hover, but want to not do it with css if i can.

Any ideas if i have missed a tag?

3 Answers 3

2

Cross browser solution:

Make a class say transition and remove it on click.

JS:

$("#infodiv").click(function () {
    $("#div2").slideToggle("slow");
    $("#div1").toggleClass("transition");
});

HTML:

<div id="div1" class="transition">

DEMO here.

Sign up to request clarification or add additional context in comments.

3 Comments

Hi Hiral, thankyou very much for these, can it be done so on click again to put the filter back on? (bit like a hover effect)
argh! it appears to transition really fast (ie. you know you can say how long something takes to change in CSS) can that not be done on the initial transition? Sorry for all the questions :)
you can always increase the time. change 1s to 5s or required time.
2

It should be

$("#div2,#div1").css("webkit-filter", "none")

Comments

0

You have missed , in your jquery selector.

It should be :

$("#div2, #div1")

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.