0

I have a script that I put together, which a button is clicked it rotates 45 degrees, I also would like it to toggle a paragraph open and closed. I don't have access to the CSS because the content management system interwoven wont' let me have accerss, so this is why it's all done with the javascript and it has to stay that way. The script is:

var img = document.images[0];
effects_of_yoga_info.style.setProperty("-webkit-transition", "-webkit-transform 0.3s ease-in-out");


var deg = 0;
effects_of_yoga_info.addEventListener('click', function() {
deg += 45;
effects_of_yoga_info.style.setProperty('-webkit-transform', 'rotateZ('+deg+'deg)');

and the part I'd like to incorporate into it so that they happen at the same time is:

$("#effects_of_yoga_info").click(function () {
  $("p#effects_of_yoga_text").slideToggle("fast");
});

I'm sure it's very simple but I've been having a hard time with it, thanks in advance.

2 Answers 2

1

You mean something like this:

$(img).click(function () {

    deg += 45;
    $(this).css('-webkit-transform', 'rotateZ(' + deg + 'deg)');

    $('#KittenText').slideToggle("fast");

});​
Sign up to request clarification or add additional context in comments.

2 Comments

well i'd like it to still animate, I have part of it set up here with teh image that rotates, but don't know how to write it as jquery so teh css is incorporated the same way as well as include the paragraph toggle. jsfiddle.net/loriensleafs/SZXyj
wow I'm really sorry, I entered the first script wrong, just updated it.
0

got it working:

var img = document.images[0];
effects_of_yoga_info.style.setProperty("-webkit-transition", "-webkit-transform 0.3s ease-in-out");


var deg = 0;
effects_of_yoga_info.addEventListener('click', function() {
$("p#effects_of_yoga_text").slideToggle("fast");
deg += 45;
effects_of_yoga_info.style.setProperty('-webkit-transform', 'rotateZ('+deg+'deg)');   
});

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.