| View previous topic :: View next topic |
| Author |
Message |
 |
doylependergrass
Joined: 27 Jun 2007 Posts: 18
|
Posted: Tue Apr 01, 2008 2:44 pm Post subject: Swapping styles programmatically |
|
|
I have a klip I'm trying to develop, that normally uses a style where the item "model" is a text field retrieved from a select box on the web page I'm parsing. I'm trying to implement the code in such a way that if I receive a 401 or 404 when accessing the page, I swap styles and
| Code: | | model {content: text; itemcol: 2} | becomes | Code: | | model {type: image; itemcol: 2} |
I've verified that the style is being swapped, but I can't get the image to show in the klip for those lines. Is what I'm trying to do even possible?
-edit-
OK, scratch that. I fixed a string that was throwing my code off. It swaps text and image ok now, but my columns are thrown off. Any way I can straighten that out? |
|
| Back to top |
|
 |
jeremyh Klipfolio Staff

Joined: 26 Jun 2006 Posts: 829 Location: Ottawa, Canada
|
Posted: Wed Apr 02, 2008 3:20 pm Post subject: |
|
|
Hi Doyle,
Try using the maxwidth property for your image:
| Code: | model {type: image; itemcol: 2; maxwidth: 2}
|
The maxwidth property is meausred in grid units. If an image would be displayed that is wider than the maxwidth, the image gets shrunk down by KlipFolio.
If that doesn't solve the problem, could you post a screenshot showing how the columns look?
Jeremy |
|
| Back to top |
|
 |
doylependergrass
Joined: 27 Jun 2007 Posts: 18
|
Posted: Thu Apr 03, 2008 10:53 am Post subject: |
|
|
| Actually, I have the opposite problem. The image is a 20x20 .png, but the text is 3-5 words, so if the image doesn't appear, the text is scooted one or two character widths to the left. I can't post a screen shot, as I've worked around it by dumping the style swap code and putting the image in it's own column. I'd rather use the same column if I can get it to work, but it's not absolutely necessary. |
|
| Back to top |
|
 |
jeremyh Klipfolio Staff

Joined: 26 Jun 2006 Posts: 829 Location: Ottawa, Canada
|
Posted: Fri Apr 04, 2008 2:59 pm Post subject: |
|
|
Hi Doyle,
I made a quick sample Klip, and now I see what you mean. KlipFolio checks to make sure the columns all line up within one style, but it doesn't check across different styles, so you wouldn't be able to get things lining up the original way you had it set up. Putting the image in a separate column is the best workaround to the problem.
Jeremy |
|
| Back to top |
|
 |
|