Trying to have it scroll based on if it was clicked on the left or right side of the page. Doesn’t seem to work.. Perhaps my syntax is incorrect or the method i’m using to find the left or right side of the page is?
with <body onclick="scrollevent()"> :
<script>
function scrollevent()
{
var y=0;
var pwidth = $('#slideshow').width();
var mouseY = ev.clientY;
if (mouseY<(pwidth/2) {
$('#slideshow').animate({scrollLeft: "+=400"});
}
else{
$('#slideshow').animate({scrollLeft: "-=400"});
}
}
</script>
You can use
pageXand not pageY property of theeventobject, try the following:Please note that there is a syntax error in your code, you have missed a
):should be: