Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to move the elem in javascript

I know Javascript in the beginning level and I need some help.

left = '-180px';
$sub_menu.show().animate({'left' : left}, 200);

I want to move $sub_menu from the right side to 180pxfrom his default position before animate it, i.e. to make the indent on the right.

!!! EDIT !!!

Here my jsfiddle

For each menu element, on mouseenter, I enlarge the image, and show both sdt_active span and sdt_wrap span. If the element has a sub menu (sdt_box), then I slide it - if the element is the last one in the menu I slide it to the left, otherwise to the right. My problem is the last Menu 6. It must work as other menus only it should slide to the left on the same width.

like image 916
olgacosta Avatar asked Jul 25 '26 04:07

olgacosta


1 Answers

I think you are searching for this:

$sub_menu.show().animate({ 'left' : '-=180px' }, 200)
like image 94
janhocevar Avatar answered Jul 27 '26 18:07

janhocevar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!