I pretty new to js and jquery so please bear with me.
I'd like to change the background-position and add 1% on #div1 while clicking on #button1 and take -1% on #div1 while clicking on #button2
How could i achive this in jQuery?
Alse, bonus question: These are going to get dynamically generated through php. Is it possible to use php in the js-script so the id's get correct?
like this:
$i = 1
while($i <= 5):
$div[$i] = 'div'.$i;
$leftbutton[$i] = 'leftbotton'.$i;
$rightbotton[$i] = 'rightbotton'.$i;
$i++;
endwhile;
Else i'll have to learn how to make loops in js as well ;)
Edit: Follow up questions:
How can i update a text field with this value as i click the buttons? And how do i modify it if i'd like to add up/down buttons as well? thanks a bunch!
Thanks in advance! -Simon