Attach to slider

</> Source
<!DOCTYPE html>
<html>
<head>
	<title>Attach to slider</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/fonts/font_roboto/roboto.css"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
	<style>
		div#sliderObj {
			margin-top: 100px;
			margin-left: 30px;
		}
	</style>
	<script>
		
		var mySlider;
		var myPop;
		
		function doOnLoad() {
			
			// init slider
			mySlider = new dhtmlXSlider({
				parent: "sliderObj",
				size: 150,
				value: 5,
				step: 1,
				min: 0,
				max: 10
			});
			
			// attach popup to slider
			myPop = new dhtmlXPopup({ slider: mySlider });
			
			// change popup value when slider moved
			mySlider.attachEvent("onChange", function(value){
				updatePopupValue(value);
			});
			
			// set initial value for popup
			updatePopupValue(mySlider.getValue());
		}
		
		function updatePopupValue(value) {
			myPop.attachHTML("Current value: "+value.toString());
		}
		
	</script>
</head>
<body onload="doOnLoad()">
	<div id="sliderObj"></div>
</body>
</html>

Documentation

Check documentation to learn how to use the components and easily implement them in your applications.