I am attempting to make a div scroll left or right either with a mouseover effect or on-click. However, I am at a loss as to what is going wrong.
Here was my attempt to do this simply:
<head>
<style>
#innerscroll{
margin-right:0px;
}
</style>
</head>
<body>
<div id="innerscroll"></div>
<img src="right.jpg"
onmouseover="document.getElementById('innerscroll').style.marginRight = setInterval(('value' + 1), 100);" />
</body>
Now, trying this, I'm wondering why it doesn't work. What am I doing wrong?
I also tried a more complex approach that also failed. Here's the code for that:
$('.nav-next').click(function(e) {
e.preventDefault();
$('#innerscroll').animate({
'margin-right' : '100px'
});
});
$('.nav-previous').click(function(e) {
e.preventDefault();
$('#innerscroll').animate({
'margin-right' : '-100px'
});
});
My last question was closed because I guess I was not specific enough. Whatever details you need please ask for and I'll edit the question!
Edit: I have the option of using jQuery but I would rather not.
Edit2: I am using setInterval to time the mouseover effect. I am thinking that it will move via mouseover or it will move via a click event.