Custom Elements Documentation

Getting Started

jqxScrollView is a HTML Element which can be used for viewing content which is wider than the visible area outlined by the device's screen. specific item can be chosen using drag movements or clicking/tapping on the buttons at the bottom of the jqxscrollview.

Every UI element from jQWidgets toolkit needs its JavaScript files to be included in order to work properly.

The first step is to create html page and add links to the javascript files and css dependencies to your project.

The jqxScrollView element requires the following files:

<script type="text/javascript" src="../scripts/webcomponents-lite.min.js"></script>
<script type="text/javascript" src="../jqwidgets/jqxcore.js"></script>
<script type="text/javascript" src="../jqwidgets/jqxcore.elements.js"></script>
<script type="text/javascript" src="../jqwidgets/jqxdata.js"></script>
<script type="text/javascript" src="../jqwidgets/jqxscrollview.js"></script>
The next step is to add the html element within the body of the html page.

<jqx-scroll-view settings="elementSettings"></jqx-scroll-view>
The last step is to initialize the element settings:
<script type="text/javascript">
JQXElements.settings["elementSettings"] =
{
animationDuration:3000, theme:"light"
}
</script>
To call a function(method), you need to pass the method name and parameters(if any) in the jqxScrollView's instance.
<script>
window.onload = function () {
var element = document.querySelector("jqx-scroll-view");
element.back();
}
</script>
To get the result of a function after calling it, you can use the following syntax: To set a property(option), you need to use the property name and value(s) along with the jqxScrollView's instance.
window.onload = function() {
document.querySelector("jqx-scroll-view").animationDuration = 30;
}
You can also set properties of HTML Elements by using Attributes. Traditionally, attributes are used to set the initial state of an element. Properties with camelCase naming have dash-based attributes. For example: A property "dataSource" will have an attribute called "data-source".

To get a property(option), you need to use the property name along with the jqxScrollView's instance.
window.onload = function() {
var propertyValue = document.querySelector("jqx-scroll-view").animationDuration;
}

Event binding can be defined in the HTML as an attribute. The syntax is: 'on-' and the event's name. Event Names with camelCase naming have dash-based attributes. The attribute's value is the event handler's name. The addEventListener function can also be used for event binding.

<script>
window.onload = function () {
var element = document.querySelector("jqx-scroll-view");
element.addEventListener("pageChanged", function(event){
// Your code here
});
}
</script>

Example

<!DOCTYPE html>
<html lang="en">
<head>
<title id='Description'>ScrollView Custom Element</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1 maximum-scale=1 minimum-scale=1" />
<link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
<link rel="stylesheet" href="../../jqwidgets/styles/jqx.light.css" type="text/css" />
<link rel="stylesheet" href="../../styles/demos.css" type="text/css" />
<script type="text/javascript" src="../../scripts/webcomponents-lite.min.js"></script>
<script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
<script type="text/javascript" src="../../jqwidgets/jqxcore.elements.js"></script>
<script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script>
<script type="text/javascript" src="../../jqwidgets/jqxscrollview.js"></script>
<script>
JQXElements.settings["scrollViewSettings"] =
{
animationDuration:3000, theme:"light"
}
</script>
</head>
<body>
<jqx-scroll-view settings="scrollViewSettings">
<div><div class="photo" style="background-image: url(../../images/imageNature1.jpg)"></div></div>
<div><div class="photo" style="background-image: url(../../images/imageNature2.jpg)"></div></div>
<div><div class="photo" style="background-image: url(../../images/imageNature3.jpg)"></div></div>
<div><div class="photo" style="background-image: url(../../images/imageNature4.jpg)"></div></div>
<div><div class="photo" style="background-image: url(../../images/imageNature5.jpg)"></div></div>
</jqx-scroll-view>
</body>
</html>

The result of the above code is: