-
25 Apr 2012 7:26 AM #1
Unanswered: Make the second carousel item show slightly
Unanswered: Make the second carousel item show slightly
Hello,
I'm using a vertical carousel with two items, and I'm trying to make it clear to the user that it's a carousel they're using. Therefore, assuming that the first carousel item is currently active, I want the second card to be pushed up slightly so that you can partially see it at the bottom.
I've tried the following. Bare in mind it isn't complete but my main thought process is there: If on the first card, it should add a class to the second card which pushes it up. It works to an extend, it applies the style and shows the second card, but then I can't remove it. Has anyone any ideas of how else to implement this?
Any help would be greatly appreciated.
Thanks
George
Sencha code:
CSS code:Code:xtype: 'carousel', direction: 'vertical', width: '100%', height: '140px', listeners: { cardswitch: function(){ var CurrentPhotoIndex = this.getActiveIndex(); var CurrentPhotoItem = this.getActiveItem(); if(CurrentPhotoIndex == '0'){ Ext.getCmp('carouselitem1').addCls('raisecarouselitem') } else if (CurrentPhotoIndex == '1'){ } } }
Code:.raisecarouselitem { -webkit-transform: translate(0,100px) !important; -webkit-transition: all 0.1s ease-in-out !important; }Last edited by george.m; 25 Apr 2012 at 7:29 AM. Reason: wrong title
-
27 Apr 2012 6:14 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,684
- Vote Rating
- 435
- Answers
- 3111
Why can't you remove the css?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
27 Apr 2012 6:38 AM #3
It seems as if the addCls() temporarily removes the item from the carousel. I think this because normally, I console log the current index, so I'd get a '0' or '1' being console.log'd as i switch cards, but after I apply the addCls, a '1' is never outputted.
So for example, once the view loads, if I slide the carousel to the second card, it doesn't apply the class because the addCls() hasn't been called yet. Then, when I switch the card back to the first card, the class is applied correctly and does correctly push the second card slightly up. This is where things go dodgy. Whenever I switch cards from this point, the card's content stays in the same position, and the console.log(this.getActiveIndex()) only gets called for the first card so I only get '1' being outputted. It is as if the second card has been removed. A removeCls() will not work, but if I remove the css classes manually in the inspect element, the problem is fixed.
Do you know of any other way that I could apply this feature?


Reply With Quote