37
rated 0 times
[
41]
[
4]
/ answers: 1 / hits: 28551
/ 10 Years ago, mon, march 3, 2014, 12:00:00
I'm trying something pretty simple in JS but I can't make it work...
I would like when clicking on a div to add a negative margin-left to another div, but I want it to happened everytime I click on the div, not only one time as it does now.
Eveytime I click on my #next_nav, I would like the #nav to move from 10px negative.
here it only works one time.
here is my js :
$(function() {
$('#next_nav').click(function () {
$( #nav ).css('margin-left','-10px');
});
});
and my HTML :
<div id=next_nav></div>
<div id=nav></div>
here is my JSfiddle : http://jsfiddle.net/Beyzd/
can anybody helps me with this ?
thanks a lot,
More From » jquery