From 7c1f50ea40992db45bd5ffd2122bcdf90780f1b0 Mon Sep 17 00:00:00 2001 From: Francisco Marcelo de Araújo Lima Júnior Date: Tue, 12 Aug 2014 19:05:26 -0300 Subject: [PATCH] small fixes --- public/javascripts/block_store.js | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/public/javascripts/block_store.js b/public/javascripts/block_store.js index 170b45b..41bdfe1 100644 --- a/public/javascripts/block_store.js +++ b/public/javascripts/block_store.js @@ -1,45 +1,51 @@ jQuery(document).ready(function () { - jQuery('#block-types-navigation a.previous').click(PreviousSlide); - jQuery('#block-types-navigation a.next').click(NextSlide); - jQuery('.block-types-group').first().addClass('active'); - jQuery(".block-types-group.active + .block-types-group").addClass('next'); + jQuery("#block-types-navigation a.previous").hide(); + jQuery('.block-types-group').first().show( 'slide', { direction : 'down' }, 1000, function() { + jQuery('.block-types-group').first().addClass('active'); + jQuery(".block-types-group.active + .block-types-group").addClass('next'); + jQuery('#block-types-navigation a.previous').click(PreviousSlide); + jQuery('#block-types-navigation a.next').click(NextSlide); + }); + firstBlockTypesGroup = jQuery(".block-types-group").first(); lastBlockTypesGroup = jQuery(".block-types-group").last(); - jQuery('.block-types-group').first().show( 'slide', { direction : 'down' }, 1000 ); - jQuery("#block-types-navigation a.previous").hide(); }); function NextSlide() { - activeBlockTypesGroup = jQuery(".block-types-group.active"); - nextBlockTypesGroup = jQuery(".block-types-group.next").first(); + activeBlockTypesGroup = jQuery(".block-types-group.active"); + nextBlockTypesGroup = jQuery(".block-types-group.next").first(); + + activeBlockTypesGroup.hide( 'slide', { direction : 'left' }, 1000); + nextBlockTypesGroup.show( 'slide', { direction : 'right' }, 1000, function() { activeBlockTypesGroup.removeClass('active'); activeBlockTypesGroup.addClass('prev'); - activeBlockTypesGroup.hide( 'slide', { direction : 'left' }, 1000 ); nextBlockTypesGroup.removeClass('next'); nextBlockTypesGroup.addClass('active'); jQuery(".block-types-group.active + .block-types-group").addClass('next'); - nextBlockTypesGroup.show( 'slide', { direction : 'right' }, 1000 ); activeBlockTypesGroup = jQuery(".block-types-group.active"); jQuery("#block-types-navigation a.previous").show(); if ( activeBlockTypesGroup.is( lastBlockTypesGroup ) ) { jQuery("#block-types-navigation a.next").hide(); } + }); } function PreviousSlide() { - activeBlockTypesGroup = jQuery(".block-types-group.active"); - previousBlockTypesGroup = jQuery(".block-types-group.prev").last(); + activeBlockTypesGroup = jQuery(".block-types-group.active"); + previousBlockTypesGroup = jQuery(".block-types-group.prev").last(); + + activeBlockTypesGroup.hide( 'slide', { direction : 'right' }, 1000 ); + previousBlockTypesGroup.show( 'slide', { direction : 'left' }, 1000, function() { activeBlockTypesGroup.removeClass('active'); activeBlockTypesGroup.addClass('next'); - activeBlockTypesGroup.hide( 'slide', { direction : 'right' }, 1000 ); previousBlockTypesGroup.removeClass('prev'); previousBlockTypesGroup.addClass('active'); - previousBlockTypesGroup.show( 'slide', { direction : 'left' }, 1000 ); activeBlockTypesGroup = jQuery(".block-types-group.active"); jQuery("#block-types-navigation a.next").show(); if ( activeBlockTypesGroup.is( firstBlockTypesGroup ) ) { jQuery("#block-types-navigation a.previous").hide(); } + }); } -- libgit2 0.21.2