The development for both desktop and mobile browsers has always been a difficult task, often an impossible one. To ease the process, we have prepared a couple of extenders, thus delivering to the developers unified methods to implement solutions for the mobile web platforms. In addition to the previously introduced TouchScrollExtender in Q3 2010, we present to you another member of the family.
The ResizeExtender is a small client-side only control that enables resize and drag functionality on an HTML element in all browsers regardless if they are desktop or mobile (except the browsers that lack the needed desktop or touch events - Mobile Opera and Mobile IE). It depends on Core.js and the built-in jQuery in RadControls for ASP.NET AJAX.
Since Q1 2008 the ResizeExtender automatically enables resizing and dragging in all browsers for the following controls: RadColorPicker, RadDock, RadEditor, RadSlider, RadSplitBar and RadWindow and as of Q1 2011, the control supports mobile browsers as well.
In order to use the ResizeExtender separately, follow these steps:
Telerik.Web.UI.ResizeExtender(jsOwner, element, handles, tableElement, document, moveCursorType, autoScrollEnabled, moveToMouseLocation);
The arguments that the constructor of the ResizeExtender class accepts are:
The HTML element for which you want to enable move and resize
handles [hash table]
A hash table with the HTML elements (the handles) that the user uses to resize and move the specified elementToMoveAndResize element.
The inner TABLE element of the specified elementToMoveAndResize element, if any.
The document, to which the specified elementToMoveAndResize element belongs. In case this parameter is not specified, the extender uses the current document.
The CSS cursor style, applied to the move handle. By default, the extender uses “move” cursor type.
A Boolean property that specifies whether the extender will change the scrollTop and(or) ScrollLeft of the browser window, when the user tries to move the specified elementToMoveAndResize element outside of the visible viewport. Note that this feature does not work in Mobile browsers.
A Boolean property that specifies whether the element will move to the click location, before the user starts dragging it. This is useful, in case the move handle is larger than the element to move. A simple example that demonstrates this case is the handle element in the HSB/HSV palettes of RadColorPicker.
Click here to download an example demonstrating how to drag and resize a DIV element. To run the example, add the .aspx page to a Telerik RadControls for ASP.NET AJAX project.
Iana Tsolova is Product Manager at Telerik’s DevTools division. She joined the company back in the beginning of 2008 as a Support Officer and has since occupied various positions at Telerik, including Senior Support Officer, Team Lead at one of the ASP.NET AJAX teams and Technical Support Director. Iana’s main interests are web development, reading articles related to geography, wild nature and latest renewable energy technologies.