Jscript and CSS - Rotate by running the div instead of an image

Asked

Viewed 226 times

0

Good morning, I used a Javascript library to rotate an image by clicking on it, in a section of javascript I put what will rotate when clicking:
$("#conteudo").rotate({
The problem is it’s spinning the entire div :(
How can I put to run only the contents of this div, I tried to put so:
$("#conteudo > img").rotate({ but it didn’t work :(, can help me??
Follow the project code running the entire div :
https://gist.github.com/SoraNoKuuhaku/7aa25f3944c7a4a038c4f114cc45ca22

2 answers

1


According to the code of your link, the image is not inside the tag with id content but inside the tag with id image, there are two image ids, and you should remove the id repeated, let’s assume that you remove the id from the tag img and leave only in the external div, you should put in your jquery code this way:

$("#imagem > img")
  • Oh yes, then it turns normally but in the image div, in the content I’m not getting, I’ll try again removing the img inside the image, a moment !!

  • Because what I want to rotate actually, is the copy of the image that goes to the content div understand? so I wanted to put #content > img

  • I managed by making $(copyimg).rotate({&#Thanks Wictor for the help !!!!

1

Could also use css instead of jquery but there is no onclick:

#conteudo > img:hover{ -ms-transform: rotate(7deg); /* IE 9 */ -webkit-transform: rotate(7deg); /* Chrome, Safari, Opera */ transform: rotate(7deg); }

  • I’ll try !! Thanks for the help, I have to study this :hover because I don’t know how to use it yet

Browser other questions tagged

You are not signed in. Login or sign up in order to post.