grabbitmedia Posted December 2, 2016 Share Posted December 2, 2016 I am tying to use a jquery slider to plot a line on a canvas when I click a button. I dont know how and where to make the value from the slider a variable that changes with the slider, it just stays with the initial slider value. $(function() { $( "#slider" ).slider({ value:100, min: 0, max: 500, step: 50, slide: function( event, ui ) { $( "#amount" ).val( "$" + ui.value ); } }); $( "#amount" ).val( "$" + $( "#slider" ).slider( "value" ) ); a=$( "#slider" ).slider( "value" ); }); </script> </head> <body> <script> function myFunction() { var c=document.getElementById("www.grabbitmedia.com"); var ctx=c.getContext("2d"); ctx.moveTo(a,50); ctx.lineTo(b,0); ctx.stroke(); } URL: http://able2know.org/topic/217704-1 Quote Link to comment Share on other sites More sharing options...
hamdirizal Posted December 22, 2016 Share Posted December 22, 2016 Try this http://projects.calebevans.me/jcanvas/ It makes drawing on canvas easier using jquery style scripting. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.