Sie sind nicht angemeldet.

1

Montag, 28. Mai 2012, 11:42

Possible to set max-percentage value?

Hi folks,

I´ve a hard time to set a max-percentage for a plugin. I need a plugin to scale with the screen but just until it reaches a specific height (640px). The logical way would be to use the onresize-event, but I just can´t find the right code *sad*

This is what I did try:
onresize="if(plugin[scaler] !== null,if(plugin[scaler].pixelheight GT 640,set(plugin[scaler].height,640),set(plugin[scaler].height,70%)));"

And this what the line does:
- check if plugin scaler exist
- check if plugin scalers height is greater than 640
- if plugin scaler is greater than 640 set height to 640, otherwise set height to 70%

It works somehow, but if I resize the browser the plugins height jumps really weird and after releasing the mouse button the plugin not always gets the correct size. As you can see, I need some help here *g*

Best regards
Nupsi

2

Montag, 28. Mai 2012, 16:26

Hi,

try calling updatepos() to have the updated pixelwidth/pixelheight sizes of the plugin element,

e.g.

Quellcode

1
onresize="if(plugin[scaler] !==  null,plugin[scaler].updatepos(); if(plugin[scaler].pixelheight GT  640,set(plugin[scaler].height,640),set(plugin[scaler].height,70%)));"


best regards,
Klaus

3

Montag, 28. Mai 2012, 19:20

Nope, unfotunately not :( The plugins scaling still jumps with every pixel the browser window gets bigger or smaller. And it jumps between the 640px and 70% back and forth. I just can´t think of any other way to tell a plugin to size up to 640px max and then stop?!

BR
Nupsi

4

Montag, 28. Mai 2012, 20:17

Hi,

here a better solution:

Quellcode

1
onresize="mul(tmp,stageheight,0.70); math.min(tmp,640); copy(plugin[scaler].height,tmp);"


best regards,
Klaus

5

Dienstag, 29. Mai 2012, 09:35

Perfect, as always *thumbup* Thanks a lot, Klaus *attention*

BR
Nupsi