View Full Version : clip rect() css property

8 Apr 2013, 7:26 AM
How to implement clip: rect() css on image dynamically with ExtJS? I tried to add style on element dynamically but there is no impact.

9 Apr 2013, 9:07 PM
You can apply styles to an Ext.dom.Element using applyStyles (http://docs.sencha.com/ext-js/4-2/#!/api/Ext.Date-method-add)(). You may first need to get (http://docs.sencha.com/ext-js/4-2/#!/api/Ext-method-get)() the HTML element before you can work with it.

10 Apr 2013, 6:13 AM
Ok, thanks! I could get it working following way:

Ext.ComponentQuery.query('image[itemId=myimage]')[0].el.dom.style.clip = 'rect(' + cliptop + 'px,' + clipright + 'px,' + clipbottom + 'px,' + clipleft +'px)';