Scale Elements
Ext has some great effects (FX) which can be found in the Ext.FX class in the API, this page demonstrates how you can scale elements using different event handlers.
Worth noting...
I added a multiple event handler in this script, this demonstrates how to have multiple events assigned to an element, on this occasion I am detecting mouseover/mouseout events to make a nice scaling div.
getWidth() has a boolean (true/false) attribute which when used gives the actual values of the element without any padding etc - very useful for accuracy in our input boxes.
Also introduced is basic value handling from input, with rudimentary error checking, we also demonstrated basic resetting of elements to values from page load. A gotcha also is to spot the el.dom.value update on the input tag rather than a straight el.value update.
Pausing between effects is introduced too as are some css changes using Ext.Element.
We used...
- Ext.FX : Provides useful effects to build upon.
- scale -> Scales an element in either direction with animation
- pause -> Pauses the animation queue of this element for (x) seconds
- highlight -> Flashes the chosen part of an element
- Ext.Element : Provides methods/functions to retrive DOM/Page elements.
- getWidth -> Provides the width of the element
- getHeight -> Provides the height of the element
- getValue -> Obtains the value attribute of the element (in this case the input)
- setStyle -> Sets CSS attributes against the element
Try it out!
- Enter a size to grow Div 2: px (x) px (y)
- (Maximum sizes : x = 650 y = 650)
I am Div #2.
Please resize me
at your leisure!
