I’m working on what is uspposed to be a simple animation that should end with the element hiding with the explode effect an a text becoming visible after that.
This is jsfiddle with the code and the animation.
The explode is called here:
jQuery('.bubble1').on('click', function () {
jQuery(this).hide('explode', { pieces: 16 } , 1000, function() { jQuery('.mytext').show(); } );
});
The problem is that the explode animation is being executed only on something that seems to be just half of the element or with the position changed, the result is not what I wanted to achieve.
Any suggestion about a possible solution?
The problem was the initial position of the element give by just css rules as follow:
The margin rule to center the element in the page was making the animation behave incorrectly.
To fix that without having to use complex calculations or complex scripting, I changed the initial position of the movement instead of using the margin rule:
By removing from the position half of the total width of the element (width + border), the element is correctly centered in the page.