var response = new $.jqx.response(); var displayInformation = function () { var os = response.os; var browser = response.browser; var device = response.device; var viewPort = response.viewPort; var documentInfo = response.document; $("#os").html("OS: " + os.name + " " + os.version); $("#osPlatform").html("Platform: " + os.platform); $("#browser").html("Browser: " + browser.name + " " + browser.version + ", Access name: " + browser.accessName); $("#device").html("Device Type: " + device.type); $("#deviceSize").html("Device Width: " + device.width + ", Height: " + device.height); $("#deviceAvailSize").html("Device AvailWidth: " + device.availWidth + ", AvailHeight: " + device.availHeight); $("#deviceSupport").html("Supports Touch Events:" + device.touch + ", VML:" + browser.vml + ", SVG: " + browser.svg + ", Canvas:" + browser.canvas); $("#viewPort").html("Viewport Width: " + viewPort.width + ", Height: " + viewPort.height); $("#documentInfo").html("Document Width: " + documentInfo.width + ", Height: " + documentInfo.height); } displayInformation(); // handles resize. var resizeFunction1 = function () { console.log("resizeFunction1 is called"); } var resizeFunction2 = function () { console.log("resizeFunction2 is called"); } response.resize([resizeFunction1, resizeFunction2]); response.pointerDown($(document), function (event, position) { // event is a "touchstart" or "mousedown" event object depending on whether the device is touch-enabled. $("#pointerInfoDown").html("Pointer Down: " + position.left + ", " + position.top); }); response.pointerUp($(document), function (event, position) { // event is a "touchend" or "mouseup" event object depending on whether the device is touch-enabled. $("#pointerInfoUp").html("Pointer Up: " + position.left + ", " + position.top); }); response.pointerMove($(document), function (event, position) { // event is a "mousemove" or "touchmove" event object depending on whether the device is touch-enabled. $("#pointerInfoMove").html("Pointer Move: " + position.left + ", " + position.top); if (device.touch) { // stops the default action of the event. event.preventDefault(); } });
Name | Description | |
---|---|---|
browser | Returns information about the Browser. | |
Returns an object with the following fields:
Code exampleGet thebrowser property.
var response = new $.jqx.response(); var browser = response.browser; // gets the current browser's name. var name = browser.name; // gets the current browser's version. var version = browser.version; Run code only for a specific browser var response = new $.jqx.response(); var browser = response.browser; if (browser.msie) { // add code specific for Internet Explorer. if (browser.version == 7) { // add code specific for Internet Explorer 7 } } else if (browser.firefox) { // add code specific for Firefox } |
||
device | Returns information about the Device. | |
Returns an object with the following fields:
Code exampleGet thedevice property.
var response = new $.jqx.response(); var device = response.device; var type = device.type; var isTouchDevice = device.touch; var screenWidth = device.width; var screenHeight = device.height; |
||
document | Returns information about the document. | |
Returns an object with the following fields:
Code exampleGet thedocument property.
var response = new $.jqx.response(); var document = response.document; var width = document.width; var height = document.height; |
||
destroy | Destroys the plug-in. | |
Code examplevar response = new $.jqx.response(); response.destroy(); |
||
resize | Callback function or functions called when the browser's window is resized. | |
Code examplevar response = new $.jqx.response(); response.resize(function (event) { // your code here. }); Code example with multiple callbacksvar response = new $.jqx.response(); var resizeFunction1 = function () { console.log("resizeFunction1 is called"); } var resizeFunction2 = function () { console.log("resizeFunction2 is called"); } response.resize([resizeFunction1, resizeFunction2]); |
||
isHidden | Checks whether a HTML Element is hidden. | |
The function accepts HTML Element as parameter and returns true, if the element is hidden or false if not.
Code examplevar response = new $.jqx.response(); var hidden = response.isHidden($("#someID")[0]); |
||
inViewPort | Checks whether a HTML Element is in the view port. | |
The function accepts HTML Element as parameter and returns true, if the element is in the view port or false if not.
Code examplevar response = new $.jqx.response(); var inViewPort = response.inViewPort($("#someID")[0]); |
||
os | Returns information about the OS. | |
Returns an object with the following fields:
Code exampleGet theos property.
var response = new $.jqx.response(); var os = response.os;
Try it: os is set to a custom function
|
||
pointerDown | Event handler for mouse and touch events that works across browsers. "pointerDown" automatically handles the "mousedown", "MSPointerDown" and "touchstart" events on an element and calls a callback function with 3 parameters(original event, pointer position and pointer type). | |
The function has 2 parameters:
Code examplevar response = new $.jqx.response(); response.pointerDown($(document), function (event, position, pointerType) { }); |
||
pointerMove | Event handler for mouse and touch events that works across browsers. "pointerMove" automatically handles the "mousemove", "MSPointerMove" and "touchmove" events on an element and calls a callback function with 3 parameters(original event, pointer position and pointer type). | |
The function has 2 parameters:
Code examplevar response = new $.jqx.response(); response.pointerMove($(document), function (event, position, pointerType) { }); |
||
pointerUp | Event handler for mouse and touch events that works across browsers. "pointerUp" automatically handles the "mouseup", "MSPointerUp" and "touchend" events on an element and calls a callback function with 3 parameters(original event, pointer position and pointer type). | |
The function has 2 parameters:
Code examplevar response = new $.jqx.response(); response.pointerUp($(document), function (event, position, pointerType) { }); |
||
refresh | Refreshes the plug-in properties. | |
Code examplevar response = new $.jqx.response(); response.refresh(); |
||
responsive | Responsive Grid System. | |
The method argument is an object with the following fields:
|
||
scroll | Returns information about the Scrollbars position. | |
Returns an object with the following fields:
Code exampleGet thescroll property.
var response = new $.jqx.response(); var scroll = response.scroll; var left = scroll.left; var top = scroll.top; |
||
viewPort | Returns information about the view port. | |
Returns an object with the following fields:
Code exampleGet theviewPort property.
var response = new $.jqx.response(); var viewPort = response.viewPort; var width = viewPort.width; var height = viewPort.height; |