Skip to content

Commit

Permalink
Merge pull request #1 from mkalus/master
Browse files Browse the repository at this point in the history
Fix fading animation not linking properly due to absolute positions
  • Loading branch information
uoziod committed Sep 6, 2015
2 parents 30b9b97 + 556ed32 commit d52e6f0
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ jQuery(document).ready(function() {

tx_simpleslider_pi1_conf['items'] = new Array();
tx_simpleslider_pi1_conf['focus'] = true;

jQuery('.tx-simpleslider-pi1-slider').each(function(count) {

jQuery(this).attr('id', 'tx-simpleslider-pi1-slider-' + count);
Expand Down Expand Up @@ -43,10 +43,11 @@ jQuery(document).ready(function() {

jQuery(this).find('.tx-simpleslider-pi1-item').css({
'position': 'absolute',
'opacity': 0
'opacity': 0,
'z-index': 0
});

jQuery(this).find('.tx-simpleslider-pi1-item:eq(0)').css({'opacity': 1});
jQuery(this).find('.tx-simpleslider-pi1-item:eq(0)').css({'opacity': 1, 'z-index': 1});

}

Expand Down Expand Up @@ -89,9 +90,11 @@ function tx_simpleslider_pi1_slide(slider) {
if (tx_simpleslider_pi1_conf['items'][slider]['currentItem'] == 0)
jQuery('#tx-simpleslider-pi1-slider-' + slider + ' .tx-simpleslider-pi1-item:gt(0)').animate({
'opacity': 0
}, tx_simpleslider_pi1_conf['animationSpeed']);
}, tx_simpleslider_pi1_conf['animationSpeed'], function() {
jQuery(this).css('z-index', 0);
});
else
jQuery('#tx-simpleslider-pi1-slider-' + slider + ' .tx-simpleslider-pi1-item:eq(' + tx_simpleslider_pi1_conf['items'][slider]['currentItem'] + ')').animate({
jQuery('#tx-simpleslider-pi1-slider-' + slider + ' .tx-simpleslider-pi1-item:eq(' + tx_simpleslider_pi1_conf['items'][slider]['currentItem'] + ')').css('z-index', 1).animate({
'opacity': 1
}, tx_simpleslider_pi1_conf['animationSpeed']);

Expand Down Expand Up @@ -123,14 +126,14 @@ function tx_simpleslider_pi1_switch(slider, slideNum) {
if (tx_simpleslider_pi1_conf['animation'] == 'fade') {

if (slideNum == 0)
jQuery('#tx-simpleslider-pi1-slider-' + slider + ' .tx-simpleslider-pi1-item:gt(0)').animate({
jQuery('#tx-simpleslider-pi1-slider-' + slider + ' .tx-simpleslider-pi1-item:gt(0)').css('z-index', 0).animate({
'opacity': 0
}, tx_simpleslider_pi1_conf['animationSpeed']);
else {
jQuery('#tx-simpleslider-pi1-slider-' + slider + ' .tx-simpleslider-pi1-item:eq(' + slideNum + ')').animate({
jQuery('#tx-simpleslider-pi1-slider-' + slider + ' .tx-simpleslider-pi1-item:eq(' + slideNum + ')').css('z-index', 1).animate({
'opacity': 1
}, tx_simpleslider_pi1_conf['animationSpeed']);
jQuery('#tx-simpleslider-pi1-slider-' + slider + ' .tx-simpleslider-pi1-item:gt(' + slideNum + ')').animate({
jQuery('#tx-simpleslider-pi1-slider-' + slider + ' .tx-simpleslider-pi1-item:gt(' + slideNum + ')').css('z-index', 0).animate({
'opacity': 0
}, tx_simpleslider_pi1_conf['animationSpeed']);
}
Expand All @@ -147,4 +150,4 @@ jQuery(window).focus(function() {

jQuery(window).blur(function() {
tx_simpleslider_pi1_conf['focus'] = false;
});
});

0 comments on commit d52e6f0

Please sign in to comment.