I am having problems when I use this plugin in firefox, chrome/chromium, and i change to another tab and wait for a while (a minute +-)
When I come back to the tab where the animation is (automatic flipping), the animation runs faster, like if all the animations that were supposed to be running while the tab is hidden are all run when returning to the tab without the proper pause.
Is this problem of javascript and the way the browser is executing the script or what?
<html>
<head>
<script type="text/javascript" src="media/js/jquery.js"></script>
<script type="text/javascript" src="media/js/base.js"></script>
<script type="text/javascript" src="media/js/rotate3di.js"></script>
<style type="text/css">
#contenedor {
border: 2px solid blue;
width:410px;
padding:70px;
border-radius: 8px 8px 8px 8px;
-moz-border-radius: 8px 8px 8px 8px;
-webkit-border-radius: 8px 8px 8px 8px;
}
.carta {
width: 320px;
border: 2px solid gray;
border-radius: 8px 8px 8px 8px;
-moz-border-radius: 8px 8px 8px 8px;
-webkit-border-radius: 8px 8px 8px 8px;
background-color: #282828;
}
.carta img {margin:10px;}
</style>
<script type="text/javascript">
window.onload = function(){
$('#animar').rotate3Di(-30, 800);
setInterval(function() {$('#animar').rotate3Di('toggle', 2000, {sideChange: mySideChange});}, 4000);
}
function mySideChange(front) {
if (front) {
$(this).css('background', '#282828');
} else {
$(this).css('background', '#CCC');
}
}
</script>
</head>
<body>
<div id="contenedor">
<div id="animar" class="carta">
<p>just a demo!</p>
<img src="media/demo.jpg">
</div>
</div>
</body>