- This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › positioning an element with jquery
Hi there! I am having the worst time troubleshooting jquery right now. As it is right now, I have an image slider that has sections controlled by tabs. I’m looking to reset the slider back when someone clicks on a different tab, but for some reason I can’t figure out how to reset the left position back. I’ve tried the following:
$(element).css('left', 272.5);
$(element).offset.left = 272.5;
$(element).offset().left = 272.5;
but nothing works. I’m using div’s inside the main sliding element and those are hidden. Does this affect it somehow? Any help is appreciated. Thanks!!
Well, 2 points I guess:
1. is there any unit? px? em?
Example:
$(element).css(‘left’, ‘272.5px’);
2. need some css before positioning:
$(element).css(‘position’, ‘fixed’); // or ‘absolute’.
Your syntax is incorrect I believe. Should be:
$(element).css('left', '272.5px');
You are right. I changed it, thanks.
Did it help you with your problem?