angular-cardflow icon indicating copy to clipboard operation
angular-cardflow copied to clipboard

Is dynamic card width possible?

Open sunshineo opened this issue 11 years ago • 5 comments

Hi,

First, nice project! Thank you! I am using bootstrap and its 12 grid system. I have picture of various sizes, and I currently display them inside a size 8 column with 2 columns on each side. I have width:100% on the picture so regardless of the size of the picture or size of the browser/device the picture stretch/shrink nicely and fill/fit the size 8 column. When user swipe, I move to next picture. I try to use this project to have slide effect but cannot. The container has a huge width to hold all the pictures so it does not wrap. The width 100% on the image will stretch it to very large and got the wrong size. Set width:auto does not work because my picture has various sizes. Set to a specific pixel works but does not work when browser/device width changes. I also tried to put the column inside cardflow. Did not work because the size 8 column has 66.66% as width and stretches to really big. I tried put the whole row inside cardflow. Also does not work. Basically the row could no longer figure out the browser/device width, or it is overwrite by cardflow. I looked a little into the code. I see a calculation of cardWidth. Is it possible to have a dynamic cardWidth calculated after bootstrap apply the width to the pictures?

Thank you in advance.

--Gordon

sunshineo avatar Aug 21 '14 07:08 sunshineo

This is untested, but cardWidth comes from scope.model.cardWidth, so you may be able to do something with a model. I will need to look at this more, once I get a bit of time.

konsumer avatar Aug 22 '14 05:08 konsumer

this might be a helpful start, if you want to have a look at dynamically messing with the model to do things.

konsumer avatar Aug 22 '14 05:08 konsumer

Thank you konsumer. I did not understand how the link you provided can help me. The example has picture size fixed at 200px when I need it to change based on the width of the column.

sunshineo avatar Aug 22 '14 06:08 sunshineo

In the console.log() you can see the properties you have access to at that moment, in the watch. For example cardWidth: 210 which might be especially relevant.

konsumer avatar Aug 22 '14 06:08 konsumer

Interesting. I'll dig in more.

sunshineo avatar Aug 29 '14 17:08 sunshineo