[jQuery] Re: Remove margin in last li in Unordered List
of course it won't work, is improper use of index(), replace index() with eq() Suggestion: instead of posting each and every thought and failed function you have every 2 minutes, this example could have been created in a very simple test page to get the methods and syntax sorted out. Would have saved us watch the floundering on each and every step of your grief. Other example you tried $("#mycarousel li[" + i + "]") is syntax problem with several workarounds including :eq() Building simple test pages is one of the best ways to learn jquery IMO. Keeping a simple template including link to jquery google source, and a $(document)ready built in you can build a test page in any directory in almost no time and debug in Firebug expresso wrote: tried this but doesn't look like you can do this $("#mycarousel li").index(i).css("margin-right", "0px").css("padding- right", "6px"); On Jul 8, 9:48pm, expresso dschin...@gmail.com wrote: Like something like this $("#mycarousel li[" + i + "]").css("margin-right", "0px").css ("padding-right", "6px"); On Jul 8, 9:46pm, expresso dschin...@gmail.com wrote: Thanks. I wonder if you can even access an li by index? On Jul 8, 9:35pm, MorningZ morni...@gmail.com wrote: Why wouldn't you just use: http://docs.jquery.com/Selectors/last $("#mycarousel li:last").css("property", "value"); On Jul 8, 10:17pm, expresso dschin...@gmail.com wrote: If I have the following: div class="jcarousel-clip jcarousel-clip-horizontal" style="width: 459px; height: 220px;" ul id="mycarousel" class="jcarousel-list jcarousel-list- horizontal" style="height: 220px; width: 918px; left: 0px;" li class="jcarousel-item jcarousel-item-horizontal jcarousel- item-1 jcarousel-item-1-horizontal" jcarouselindex="1" /li li class="jcarousel-item jcarousel-item-horizontal jcarousel- item-2 jcarousel-item-2-horizontal" jcarouselindex="2" /li li class="jcarousel-item jcarousel-item-horizontal jcarousel- item-3 jcarousel-item-3-horizontal" jcarouselindex="3" /li /ul /div Trying to figure out how I can do a .each on each li and then add an additional style to the last li in the list.
[jQuery] Re: Remove margin in last li in Unordered List
I did not know about eq and I don't have all fing day to figure this out as I am very new to jQuery. I do my dilligence and read the books, try some stuff out and then when I am not sure of another way to do this I post. It's not like I am posting every step of the way although it msut appear that to you. I tried a few things before I posted. On Jul 9, 7:04 am, Charlie charlie...@gmail.com wrote: of course it won't work, is improper use of index(), replace index() with eq() Suggestion: instead of posting each and every thought and failed function you have every 2 minutes, this example could have been created in a very simple test page to get the methods and syntax sorted out. Would have saved us watch the floundering on each and every step of your grief. Other example you tried $(#mycarousel li[ + i + ]) is syntax problem with several workarounds including :eq() Building simple test pages is one of the best ways to learn jquery IMO. Keeping a simple template including link to jquery google source, and a $(document)ready built in you can build a test page in any directory in almost no time and debug in Firebug expresso wrote:tried this but doesn't look like you can do this $(#mycarousel li).index(i).css(margin-right, 0px).css(padding- right, 6px); On Jul 8, 9:48 pm, expressodschin...@gmail.comwrote:Like something like this $(#mycarousel li[ + i + ]).css(margin-right, 0px).css (padding-right, 6px); On Jul 8, 9:46 pm, expressodschin...@gmail.comwrote:Thanks. I wonder if you can even access an li by index?On Jul 8, 9:35 pm, MorningZmorni...@gmail.comwrote:Why wouldn't you just use:http://docs.jquery.com/Selectors/last$(#mycarousel li:last).css(property, value);On Jul 8, 10:17 pm, expressodschin...@gmail.comwrote:If I have the following:div class=jcarousel-clip jcarousel-clip-horizontal style=width: 459px; height: 220px; ul id=mycarousel class=jcarousel-list jcarousel-list- horizontal style=height: 220px; width: 918px; left: 0px; li class=jcarousel-item jcarousel-item-horizontal jcarousel- item-1 jcarousel-item-1-horizontal jcarouselindex=1 /li li class=jcarousel-item jcarousel-item-horizontal jcarousel- item-2 jcarousel-item-2-horizontal jcarouselindex=2 /li li class=jcarousel-item jcarousel-item-horizontal jcarousel- item-3 jcarousel-item-3-horizontal jcarouselindex=3 /li /ul /divTrying to figure out how I can do a .each on each li and then add an additional style to the last li in the list.
[jQuery] Re: Remove margin in last li in Unordered List
I did not know about eq and I don't have all fing day to figure this http://docs.jquery.com/Core/index http://docs.jquery.com/Traversing/eq Most everything you will need is in the docs. It's worth spending some time studying them. On Jul 9, 11:52 am, expresso dschin...@gmail.com wrote: I did not know about eq and I don't have all fing day to figure this out as I am very new to jQuery. I do my dilligence and read the books, try some stuff out and then when I am not sure of another way to do this I post. It's not like I am posting every step of the way although it msut appear that to you. I tried a few things before I posted. On Jul 9, 7:04 am, Charlie charlie...@gmail.com wrote: of course it won't work, is improper use of index(), replace index() with eq() Suggestion: instead of posting each and every thought and failed function you have every 2 minutes, this example could have been created in a very simple test page to get the methods and syntax sorted out. Would have saved us watch the floundering on each and every step of your grief. Other example you tried $(#mycarousel li[ + i + ]) is syntax problem with several workarounds including :eq() Building simple test pages is one of the best ways to learn jquery IMO. Keeping a simple template including link to jquery google source, and a $(document)ready built in you can build a test page in any directory in almost no time and debug in Firebug expresso wrote:tried this but doesn't look like you can do this $(#mycarousel li).index(i).css(margin-right, 0px).css(padding- right, 6px); On Jul 8, 9:48 pm, expressodschin...@gmail.comwrote:Like something like this $(#mycarousel li[ + i + ]).css(margin-right, 0px).css (padding-right, 6px); On Jul 8, 9:46 pm, expressodschin...@gmail.comwrote:Thanks. I wonder if you can even access an li by index?On Jul 8, 9:35 pm, MorningZmorni...@gmail.comwrote:Why wouldn't you just use:http://docs.jquery.com/Selectors/last$(#mycarousel li:last).css(property, value);On Jul 8, 10:17 pm, expressodschin...@gmail.comwrote:If I have the following:div class=jcarousel-clip jcarousel-clip-horizontal style=width: 459px; height: 220px; ul id=mycarousel class=jcarousel-list jcarousel-list- horizontal style=height: 220px; width: 918px; left: 0px; li class=jcarousel-item jcarousel-item-horizontal jcarousel- item-1 jcarousel-item-1-horizontal jcarouselindex=1 /li li class=jcarousel-item jcarousel-item-horizontal jcarousel- item-2 jcarousel-item-2-horizontal jcarouselindex=2 /li li class=jcarousel-item jcarousel-item-horizontal jcarousel- item-3 jcarousel-item-3-horizontal jcarouselindex=3 /li /ul /divTrying to figure out how I can do a .each on each li and then add an additional style to the last li in the list.
[jQuery] Re: Remove margin in last li in Unordered List
Why wouldn't you just use: http://docs.jquery.com/Selectors/last $(#mycarousel li:last).css(property, value); On Jul 8, 10:17 pm, expresso dschin...@gmail.com wrote: If I have the following: div class=jcarousel-clip jcarousel-clip-horizontal style=width: 459px; height: 220px; ul id=mycarousel class=jcarousel-list jcarousel-list- horizontal style=height: 220px; width: 918px; left: 0px; li class=jcarousel-item jcarousel-item-horizontal jcarousel- item-1 jcarousel-item-1-horizontal jcarouselindex=1 /li li class=jcarousel-item jcarousel-item-horizontal jcarousel- item-2 jcarousel-item-2-horizontal jcarouselindex=2 /li li class=jcarousel-item jcarousel-item-horizontal jcarousel- item-3 jcarousel-item-3-horizontal jcarouselindex=3 /li /ul /div Trying to figure out how I can do a .each on each li and then add an additional style to the last li in the list.
[jQuery] Re: Remove margin in last li in Unordered List
Thanks. I wonder if you can even access an li by index? On Jul 8, 9:35 pm, MorningZ morni...@gmail.com wrote: Why wouldn't you just use: http://docs.jquery.com/Selectors/last $(#mycarousel li:last).css(property, value); On Jul 8, 10:17 pm, expresso dschin...@gmail.com wrote: If I have the following: div class=jcarousel-clip jcarousel-clip-horizontal style=width: 459px; height: 220px; ul id=mycarousel class=jcarousel-list jcarousel-list- horizontal style=height: 220px; width: 918px; left: 0px; li class=jcarousel-item jcarousel-item-horizontal jcarousel- item-1 jcarousel-item-1-horizontal jcarouselindex=1 /li li class=jcarousel-item jcarousel-item-horizontal jcarousel- item-2 jcarousel-item-2-horizontal jcarouselindex=2 /li li class=jcarousel-item jcarousel-item-horizontal jcarousel- item-3 jcarousel-item-3-horizontal jcarouselindex=3 /li /ul /div Trying to figure out how I can do a .each on each li and then add an additional style to the last li in the list.
[jQuery] Re: Remove margin in last li in Unordered List
Like something like this $(#mycarousel li[ + i + ]).css(margin-right, 0px).css (padding-right, 6px); On Jul 8, 9:46 pm, expresso dschin...@gmail.com wrote: Thanks. I wonder if you can even access an li by index? On Jul 8, 9:35 pm, MorningZ morni...@gmail.com wrote: Why wouldn't you just use: http://docs.jquery.com/Selectors/last $(#mycarousel li:last).css(property, value); On Jul 8, 10:17 pm, expresso dschin...@gmail.com wrote: If I have the following: div class=jcarousel-clip jcarousel-clip-horizontal style=width: 459px; height: 220px; ul id=mycarousel class=jcarousel-list jcarousel-list- horizontal style=height: 220px; width: 918px; left: 0px; li class=jcarousel-item jcarousel-item-horizontal jcarousel- item-1 jcarousel-item-1-horizontal jcarouselindex=1 /li li class=jcarousel-item jcarousel-item-horizontal jcarousel- item-2 jcarousel-item-2-horizontal jcarouselindex=2 /li li class=jcarousel-item jcarousel-item-horizontal jcarousel- item-3 jcarousel-item-3-horizontal jcarouselindex=3 /li /ul /div Trying to figure out how I can do a .each on each li and then add an additional style to the last li in the list.
[jQuery] Re: Remove margin in last li in Unordered List
tried this but doesn't look like you can do this $(#mycarousel li).index(i).css(margin-right, 0px).css(padding- right, 6px); On Jul 8, 9:48 pm, expresso dschin...@gmail.com wrote: Like something like this $(#mycarousel li[ + i + ]).css(margin-right, 0px).css (padding-right, 6px); On Jul 8, 9:46 pm, expresso dschin...@gmail.com wrote: Thanks. I wonder if you can even access an li by index? On Jul 8, 9:35 pm, MorningZ morni...@gmail.com wrote: Why wouldn't you just use: http://docs.jquery.com/Selectors/last $(#mycarousel li:last).css(property, value); On Jul 8, 10:17 pm, expresso dschin...@gmail.com wrote: If I have the following: div class=jcarousel-clip jcarousel-clip-horizontal style=width: 459px; height: 220px; ul id=mycarousel class=jcarousel-list jcarousel-list- horizontal style=height: 220px; width: 918px; left: 0px; li class=jcarousel-item jcarousel-item-horizontal jcarousel- item-1 jcarousel-item-1-horizontal jcarouselindex=1 /li li class=jcarousel-item jcarousel-item-horizontal jcarousel- item-2 jcarousel-item-2-horizontal jcarouselindex=2 /li li class=jcarousel-item jcarousel-item-horizontal jcarousel- item-3 jcarousel-item-3-horizontal jcarouselindex=3 /li /ul /div Trying to figure out how I can do a .each on each li and then add an additional style to the last li in the list.