Skip to content

Instantly share code, notes, and snippets.

@ekinertac
Created March 30, 2012 22:59
Show Gist options
  • Save ekinertac/2257238 to your computer and use it in GitHub Desktop.
Save ekinertac/2257238 to your computer and use it in GitHub Desktop.
jQuery / CSS rotation on click
<html>
<head>
<link href="test2.css" rel="stylesheet" type="text/css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
</head>
<body onclick="Spin()">
<div class="helpTip">
<h2>Click Anywhere</h2>
<div>to start</div>
</div>
<script type="text/javascript">
function Spin() {
if ($('.helpTip').hasClass('spin') == false)
{
$('.helpTip').addClass('spin');
}
else
{
$('.spin').css('-webkit-animation-name', 'none');
setTimeout(function() {
$('.spin').css('-webkit-animation-name', 'spins');
}, 0);
}
};
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment