<!DOCTYPE html>
<
html
lang
=
"en"
>
<
head
>
<
link
rel
=
"stylesheet"
href
=
"jqwidgets/styles/jqx.base.css"
type
=
"text/css"
/>
<
script
type
=
"text/javascript"
src
=
"scripts/jquery-1.11.1.min.js"
>
</
script
>
<
script
type
=
"text/javascript"
src
=
"jqwidgets/jqxcore.js"
>
</
script
>
<
script
type
=
"text/javascript"
src
=
"jqwidgets/jqxdraw.js"
>
</
script
>
<
script
type
=
"text/javascript"
src
=
"jqwidgets/jqx-all.js"
>
</
script
>
</
head
>
<
body
>
<
center
>
<
h1
style
=
"color:green;"
>
GeeksforGeeks
</
h1
>
<
h3
>jQWidgets jqxDraw on() Method</
h3
>
<
div
id
=
"jqx_Draw"
style
=
"height:200px; width:700px;"
>
</
div
>
<
div
id
=
"log"
></
div
>
<
script
type
=
"text/javascript"
>
$(document).ready(function () {
$('#jqx_Draw').jqxDraw();
var Instance = $('#jqx_Draw').jqxDraw('getInstance');
// Creating a circle with cx of 130, cy of 50,
// radius of 25 and parameters for filling the
// circle with green color
var Element = Instance.circle(130, 50, 25, {
fill: 'green'
});
Instance.on(Element, 'click', function () {
// Getting the Y coordinate of the circle's center
var Y_Coordinate = parseInt(
Instance.getAttr(Element, 'cy'));
// Moving the circle down with 15 pixels
Instance.attr(Element, {
cy: Y_Coordinate + 15
});
});
Instance.refresh();
});
</
script
>
</
center
>
</
body
>
</
html
>