[jQuery] Re: Rotating CSS classes each 5 sec

2009-03-24 Thread Alexandru Dinulescu
Hey guys.

Thanks for all your help, i am not very proeficient in Javascript (jQuery)
and i really appreciate you taking your time to explain stuff. I found it
very useful.

Best Regards
AlexD
---
Alexandru Dinulescu
Web Developer
(X)HTML/CSS Specialist
Expert Guarantee Certified Developer
XHTML: http://www.expertrating.com/transcript.asp?transcriptid=1879053
CSS : http://www.expertrating.com/transcript.asp?transcriptid=1870619
RentACoder Profile:
http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInfo.aspx?lngAuthorId=6995323

MainWebsite: http://alexd.adore.ro



On Mon, Mar 23, 2009 at 2:05 PM, RobG  wrote:

>
>
>
> On Mar 23, 2:33 pm, mkmanning  wrote:
> > Presumably, which points out a recurring problem: because we don't
> > know the OP's intended use, vis-à-vis actual markup and CSS, etc.
> > everything we suggest is somewhat academic.
>
> Other suggestions proposed iterating over collections of elements, I
> was pointing out an alternative.
>
> > There's a tradeoff with
> > modifying style rules vs. using class names. If you find yourself
> > having to alter too many styles, it can become cumbersome and more
>
> Naturally, the intention is not to iterate over anything and simply
> modify a single rule.
>
>
> > prone to errors
>
> It is no more error prone than any other method.
>
> > (and your presentation layer is now beginning to
> > pollute your behavior layer).
>
> Not necessarily.  The values to be altered can themselves be
> encapsulated in css rules accessed by class - instead of iterating
> over some collection of elements with the same class, you swap the
> rules of one class for those of another.
>
> > Class names allow you to roll up several
> > styles into one 'package' as well as take advantage of CSS hierarchy
> > (which you could use e.g. to affect the results of the js modification
> > to the style).
>
> Which is not precluded by altering style rules, it is just a different
> approach.
>
>
> > For the OP's situation, i.e. changing a background image, it might be
> > even more efficient to use a sprite-- a single image (so you'd only
> > have a single http request), and re-position the image on each
> > rotation. That could be done in the JavaScript as you suggest, but I'd
> > still prefer to abstract it to classes rather than have to keep
> > position information in the js:
>
> Moving an image within an element with overflow hidden can be achieved
> either way.  The style data does not have to be hard coded in the
> script, it only needs to be passed parameters that tell it which rules
> to replace with which other rules, that can be all the rules of class
> A with all the rules of class B (or similar).
>
>
> > .img1,.img2, .img3,.img4,.img5 {
> >background-image:#fff url(some_image_url) 0 0 no-repeat;}
> >
> > .img2{
> >background-position:0 100px;}
> >
> > .img3{
> >background-image:50px 0;}
> >
> > etc...
>
> .theDisplayedRule {}
>
> now just write the rules in .imgN to .theDisplayedRule and any element
> with class theDisplayedRule will get the changes.
>
>
>
> > Since it's presentational,
>
> That is not precluded by swapping rules, it depends on how it is
> implemented.
>
> [...]
> > I think the fact that everybody has a
> > different approach makes it very interesting though; I hope the OP can
> > see at least that there are many ways to come at the same problem.
>
> Yes.
>
> --
> Rob


[jQuery] Re: Rotating CSS classes each 5 sec

2009-03-22 Thread Alexandru Dinulescu
THANK YOU!
This works perfectly, exactly what i needed

Best Regards
---
Alexandru Dinulescu
Web Developer
(X)HTML/CSS Specialist
Expert Guarantee Certified Developer
XHTML: http://www.expertrating.com/transcript.asp?transcriptid=1879053
CSS : http://www.expertrating.com/transcript.asp?transcriptid=1870619
RentACoder Profile:
http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInfo.aspx?lngAuthorId=6995323

MainWebsite: http://alexd.adore.ro



On Sun, Mar 22, 2009 at 12:40 PM, T.J. Crowder wrote:

>
> Hi,
>
> If you want the really dead simple version, assign the relevant
> elements a class name you won't be changing (such a "rotates"), then
> use something like this:
>
> * * * * Also on Pastie: http://pastie.org/423361
> var rotateTimer;
> var rotateClassNames = ['img1', 'img2', 'img3', 'img4', 'img5'];
> var rotateIndex = rotateClassNames.length - 1;
>
> $(function() {
>// Do the first one right away
>rotateClass();
>
>// Do the remainder at 5 second intervals
>rotateTimer = setInterval(rotateClass, 5000);
>
>// Offer a way of stopping (optional)
>$('#btnStop').click(stopRotating);
> });
>
> function rotateClass() {
>var divs;
>
>// Get all matching elements
>divs = $('div.rotates');
>
>// Remove the current class
>divs.removeClass(rotateClassNames[rotateIndex]);
>
>// Move to the next
>++rotateIndex;
>if (rotateIndex >= rotateClassNames.length) {
>rotateIndex = 0;
>}
>
>// Add it
>divs.addClass(rotateClassNames[rotateIndex]);
> }
>
> function stopRotating() {
>if (rotateTimer) {
>clearInterval(rotateTimer);
>rotateTimer = undefined;
>}
> }
> * * * *
>
> You would probably want to generalize that into a reusable module of
> some kind, but the logic is simple enough.
>
> HTH,
> --
> T.J. Crowder
> tj / crowder software / com
> Independent Software Engineer, consulting services available
>
>
> On Mar 22, 9:21 am, Alexandru Dinulescu  wrote:
> > My html looks like
> > 
> > 
> > 
> >
> > 
> > 
> > 
> >
> > my js is the last one
> >
> > $(function(){
> >   function rotateClass(){
> >  var el = $(this), classes = el.data('classes'), cur = el.data
> > ('current-class'), next = cur++;
> >  if (next+1 > classes.length) next = 0;
> >  el.removeClass(classes[ cur ]).addClass(classes[ next ] ).data
> > ('current-class', next);
> >   }
> >   var mobile = $('.mobileclass').each(function(){
> >  var el = $(this), classes = el.attr('thru').split(',');
> >  el.data('classes', classes).data('current-class', 0).bind
> > ('rotate-class', rotateClass).addClass(classes[0]);
> >   });
> >   setInterval(function(){ mobile.trigger('rotate-class') }, 5000);
> >
> > });
> >
> > and it doesnt work ... ? nothing is happening when i refresh the page.
> >
> > I just need a very easy stuff done, have 5 css classes i want rotated in
> a
> > div each 5 seconds, just an array, the classes can be definied inside the
> js
> > file.
> >
> > ---
> > Alexandru Dinulescu
> > Web Developer
> > (X)HTML/CSS Specialist
> > Expert Guarantee Certified Developer
> > XHTML:http://www.expertrating.com/transcript.asp?transcriptid=1879053
> > CSS :http://www.expertrating.com/transcript.asp?transcriptid=1870619
> > RentACoder Profile:
> http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInf...
> >
> > MainWebsite:http://alexd.adore.ro
> >
> > On Sun, Mar 22, 2009 at 4:56 AM, Eric Garside  wrote:
> >
> > > Try something like the following:
> >
> > > 
> >
> > > And the js:
> >
> > > $(function(){
> > >   function rotateClass(){
> > >  var el = $(this), classes = el.data('classes'), cur = el.data
> > > ('current-class'), next = cur++;
> > >  if (next+1 > classes.length) next = 0;
> > >  el.removeClass(classes[ cur ]).addClass(classes[ next ] ).data
> > > ('current-class', next);
> > >   }
> > >   var mobile = $('.mobileclass').each(function(){
> > >  var el = $(this), classes = el.attr(&

[jQuery] Re: Rotating CSS classes each 5 sec

2009-03-22 Thread Alexandru Dinulescu
My html looks like








my js is the last one

$(function(){
  function rotateClass(){
 var el = $(this), classes = el.data('classes'), cur = el.data
('current-class'), next = cur++;
 if (next+1 > classes.length) next = 0;
 el.removeClass(classes[ cur ]).addClass(classes[ next ] ).data
('current-class', next);
  }
  var mobile = $('.mobileclass').each(function(){
 var el = $(this), classes = el.attr('thru').split(',');
 el.data('classes', classes).data('current-class', 0).bind
('rotate-class', rotateClass).addClass(classes[0]);
  });
  setInterval(function(){ mobile.trigger('rotate-class') }, 5000);
});

and it doesnt work ... ? nothing is happening when i refresh the page.

I just need a very easy stuff done, have 5 css classes i want rotated in a
div each 5 seconds, just an array, the classes can be definied inside the js
file.


---
Alexandru Dinulescu
Web Developer
(X)HTML/CSS Specialist
Expert Guarantee Certified Developer
XHTML: http://www.expertrating.com/transcript.asp?transcriptid=1879053
CSS : http://www.expertrating.com/transcript.asp?transcriptid=1870619
RentACoder Profile:
http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInfo.aspx?lngAuthorId=6995323

MainWebsite: http://alexd.adore.ro



On Sun, Mar 22, 2009 at 4:56 AM, Eric Garside  wrote:

>
> Try something like the following:
>
> 
>
> And the js:
>
> $(function(){
>   function rotateClass(){
>  var el = $(this), classes = el.data('classes'), cur = el.data
> ('current-class'), next = cur++;
>  if (next+1 > classes.length) next = 0;
>  el.removeClass(classes[ cur ]).addClass(classes[ next ] ).data
> ('current-class', next);
>   }
>   var mobile = $('.mobileclass').each(function(){
>  var el = $(this), classes = el.attr('thru').split(',');
>  el.data('classes', classes).data('current-class', 0).bind
> ('rotate-class', rotateClass).addClass(classes[0]);
>   });
>   setInterval(function(){ mobile.trigger('rotate-class') }, 5000);
> });
>
> On Mar 21, 2:03 pm, mkmanning  wrote:
> > NaN is happening because of an error in this line:
> >
> > parseInt(div.className.substring(3));
> >
> > It most likely means your className is different.
> >
> > I just tested the code in Firefox on this markup and it works as it
> > should:
> >
> > 
> >
> > What does your html and js look like?
> >
> > On Mar 21, 7:21 am, Alexandru Dinulescu  wrote:
> >
> > > Hello.
> >
> > > I am getting a imgNaN when using this, can you tell me how i can make
> the
> > > array script work since that doesnt work either.
> >
> > > ---
> > > Alexandru Dinulescu
> > > Web Developer
> > > (X)HTML/CSS Specialist
> > > Expert Guarantee Certified Developer
> > > XHTML:http://www.expertrating.com/transcript.asp?transcriptid=1879053
> > > CSS :http://www.expertrating.com/transcript.asp?transcriptid=1870619
> > > RentACoder Profile:
> http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInf...
> >
> > > MainWebsite:http://alexd.adore.ro
> >
> > > On Sat, Mar 21, 2009 at 4:13 AM, mkmanning 
> wrote:
> >
> > > > Another alternative (no array needed, goes from img1 to img5 and
> > > > starts over):
> >
> > > > $(document).ready(function(){
> > > >div = $('div.img1')[0], //get with whatever selector once
> > > >swapDiv = setInterval(function(){
> > > >n = parseInt(div.className.substring(3));
> > > >div.className = 'img'+( n>4?1:n+1 );
> > > >},5000);
> > > > });
> >
> > > > If you want to stop it later, just call clearInterval('swapDiv');
> > > > It's probably a little more efficient :)
> >
> > > > On Mar 20, 12:23 pm, Alexandru Dinulescu 
> > > > wrote:
> > > > > Hello.
> >
> > > > > Can i call this function normally like
> > > > > function imageSwap(){
> > > > > function code goes in here
> >
> > > > > }
> >
> > > > > $(document).ready(imageSwap);
> > > > > ?
> >
> > > > > And another question
> > > > > can i put

[jQuery] Re: Rotating CSS classes each 5 sec

2009-03-21 Thread Alexandru Dinulescu
Hello.

I am getting a imgNaN when using this, can you tell me how i can make the
array script work since that doesnt work either.

---
Alexandru Dinulescu
Web Developer
(X)HTML/CSS Specialist
Expert Guarantee Certified Developer
XHTML: http://www.expertrating.com/transcript.asp?transcriptid=1879053
CSS : http://www.expertrating.com/transcript.asp?transcriptid=1870619
RentACoder Profile:
http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInfo.aspx?lngAuthorId=6995323

MainWebsite: http://alexd.adore.ro



On Sat, Mar 21, 2009 at 4:13 AM, mkmanning  wrote:

>
> Another alternative (no array needed, goes from img1 to img5 and
> starts over):
>
> $(document).ready(function(){
>div = $('div.img1')[0], //get with whatever selector once
>swapDiv = setInterval(function(){
>n = parseInt(div.className.substring(3));
>div.className = 'img'+( n>4?1:n+1 );
>},5000);
> });
>
> If you want to stop it later, just call clearInterval('swapDiv');
> It's probably a little more efficient :)
>
> On Mar 20, 12:23 pm, Alexandru Dinulescu 
> wrote:
> > Hello.
> >
> > Can i call this function normally like
> > function imageSwap(){
> > function code goes in here
> >
> > }
> >
> > $(document).ready(imageSwap);
> > ?
> >
> > And another question
> > can i put in the array paramters and have variables declared at the top
> > for ex is this correct?
> >
> > function imageSwap() {
> > var img1 = classImg1
> > var img2 = classImg2
> > var img3 = classImg3
> >
> > var imgArray = [ "img1" , "img2", "img3"];
> >
> > function swap(i){
> >if(imgArray.length > i){
> >$('.' + imgArray[i]).removeClass(
> >
> >
> >
> > > imgArray[i]).addClass(imgArray[i+1]);
> > >}else{
> > >return;
> > >}
> > > setTimeout("swap("+(i+1)+")", 5000);
> > > }
> >
> > > // Call the function
> > > swap(0);
> >
> > }
> >
> > $(document).ready(imageSwap);
> > ---
> > Alexandru Dinulescu
> > Web Developer
> > (X)HTML/CSS Specialist
> > Expert Guarantee Certified Developer
> > XHTML:http://www.expertrating.com/transcript.asp?transcriptid=1879053
> > CSS :http://www.expertrating.com/transcript.asp?transcriptid=1870619
> > RentACoder Profile:
> http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInf...
> >
> > MainWebsite:http://alexd.adore.ro
> >
> > On Fri, Mar 20, 2009 at 2:39 PM, jQuery Lover 
> wrote:
> >
> > > The code is not perfect:
> >
> > > var imgArray = [ "img1" , "img2", "img3"];
> >
> > > function swap(i){
> > >if(imgArray.length > i){
> > >$('.' +
> > > imgArray[i]).removeClass(imgArray[i]).addClass(imgArray[i+1]);
> > >}else{
> > >return;
> > >}
> > > setTimeout("swap("+(i+1)+")", 5000);
> > > }
> >
> > > // Call the function
> > > swap(0);
> >
> > > 
> > > Read jQuery HowTo Resource  -  http://jquery-howto.blogspot.com
> >
> > > On Fri, Mar 20, 2009 at 5:15 PM, Alexandru Dinulescu
> > >  wrote:
> > > > Hello.
> >
> > > > I have a huge question. I need something that rotates classes each 5
> > > seconds
> > > > for ex
> >
> > > > I have a  . I want each 5 seconds the class
> to be
> > > > changed from img1 to img2, and so on so at the start an array should
> be
> > > > placed like
> > > > imgArray = [ "img1" , "img2", "img3",  etc ]
> >
> > > > I need css classes changed not a plain image since  the image is a
> > > > background image and i have text on it.
> >
> > > > I did look over google but i couldnt find any help regarding this
> matter.
> >
> > > > Thank you
> >
> > > > ---
> > > > Alexandru Dinulescu
> > > > Web Developer
> > > > (X)HTML/CSS Specialist
> > > > Expert Guarantee Certified Developer
> > > > XHTML:
> http://www.expertrating.com/transcript.asp?transcriptid=1879053
> > > > CSS :http://www.expertrating.com/transcript.asp?transcriptid=1870619
> > > > RentACoder Profile:
> >
> > >http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInf.
> ..
> >
> > > > MainWebsite:http://alexd.adore.ro
>


[jQuery] Re: Rotating CSS classes each 5 sec

2009-03-20 Thread Alexandru Dinulescu
Hello.

Can i call this function normally like
function imageSwap(){
function code goes in here
}

$(document).ready(imageSwap);
?

And another question
can i put in the array paramters and have variables declared at the top
for ex is this correct?

function imageSwap() {
var img1 = classImg1
var img2 = classImg2
var img3 = classImg3

var imgArray = [ "img1" , "img2", "img3"];

function swap(i){
   if(imgArray.length > i){
   $('.' + imgArray[i]).removeClass(
>
> imgArray[i]).addClass(imgArray[i+1]);
>}else{
>return;
>}
> setTimeout("swap("+(i+1)+")", 5000);
> }
>
> // Call the function
> swap(0);
>

}

$(document).ready(imageSwap);
---
Alexandru Dinulescu
Web Developer
(X)HTML/CSS Specialist
Expert Guarantee Certified Developer
XHTML: http://www.expertrating.com/transcript.asp?transcriptid=1879053
CSS : http://www.expertrating.com/transcript.asp?transcriptid=1870619
RentACoder Profile:
http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInfo.aspx?lngAuthorId=6995323

MainWebsite: http://alexd.adore.ro



On Fri, Mar 20, 2009 at 2:39 PM, jQuery Lover  wrote:

>
> The code is not perfect:
>
> var imgArray = [ "img1" , "img2", "img3"];
>
> function swap(i){
>if(imgArray.length > i){
>$('.' +
> imgArray[i]).removeClass(imgArray[i]).addClass(imgArray[i+1]);
>}else{
>return;
>}
> setTimeout("swap("+(i+1)+")", 5000);
> }
>
> // Call the function
> swap(0);
>
> 
> Read jQuery HowTo Resource  -  http://jquery-howto.blogspot.com
>
>
>
> On Fri, Mar 20, 2009 at 5:15 PM, Alexandru Dinulescu
>  wrote:
> > Hello.
> >
> > I have a huge question. I need something that rotates classes each 5
> seconds
> > for ex
> >
> > I have a  . I want each 5 seconds the class to be
> > changed from img1 to img2, and so on so at the start an array should be
> > placed like
> > imgArray = [ "img1" , "img2", "img3",  etc ]
> >
> > I need css classes changed not a plain image since  the image is a
> > background image and i have text on it.
> >
> > I did look over google but i couldnt find any help regarding this matter.
> >
> > Thank you
> >
> > ---
> > Alexandru Dinulescu
> > Web Developer
> > (X)HTML/CSS Specialist
> > Expert Guarantee Certified Developer
> > XHTML: http://www.expertrating.com/transcript.asp?transcriptid=1879053
> > CSS : http://www.expertrating.com/transcript.asp?transcriptid=1870619
> > RentACoder Profile:
> >
> http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInfo.aspx?lngAuthorId=6995323
> >
> > MainWebsite: http://alexd.adore.ro
> >
> >
>


[jQuery] Re: Rotating CSS classes each 5 sec

2009-03-20 Thread Alexandru Dinulescu
Thank you.

I will try that tomorrow morning and see if it works

Cheers

---
Alexandru Dinulescu
Web Developer
(X)HTML/CSS Specialist
Expert Guarantee Certified Developer
XHTML: http://www.expertrating.com/transcript.asp?transcriptid=1879053
CSS : http://www.expertrating.com/transcript.asp?transcriptid=1870619
RentACoder Profile:
http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInfo.aspx?lngAuthorId=6995323

MainWebsite: http://alexd.adore.ro



On Fri, Mar 20, 2009 at 2:39 PM, jQuery Lover  wrote:

>
> The code is not perfect:
>
> var imgArray = [ "img1" , "img2", "img3"];
>
> function swap(i){
>if(imgArray.length > i){
>$('.' +
> imgArray[i]).removeClass(imgArray[i]).addClass(imgArray[i+1]);
>}else{
>return;
>}
> setTimeout("swap("+(i+1)+")", 5000);
> }
>
> // Call the function
> swap(0);
>
> ----
> Read jQuery HowTo Resource  -  http://jquery-howto.blogspot.com
>
>
>
> On Fri, Mar 20, 2009 at 5:15 PM, Alexandru Dinulescu
>  wrote:
> > Hello.
> >
> > I have a huge question. I need something that rotates classes each 5
> seconds
> > for ex
> >
> > I have a  . I want each 5 seconds the class to be
> > changed from img1 to img2, and so on so at the start an array should be
> > placed like
> > imgArray = [ "img1" , "img2", "img3",  etc ]
> >
> > I need css classes changed not a plain image since  the image is a
> > background image and i have text on it.
> >
> > I did look over google but i couldnt find any help regarding this matter.
> >
> > Thank you
> >
> > ---
> > Alexandru Dinulescu
> > Web Developer
> > (X)HTML/CSS Specialist
> > Expert Guarantee Certified Developer
> > XHTML: http://www.expertrating.com/transcript.asp?transcriptid=1879053
> > CSS : http://www.expertrating.com/transcript.asp?transcriptid=1870619
> > RentACoder Profile:
> >
> http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInfo.aspx?lngAuthorId=6995323
> >
> > MainWebsite: http://alexd.adore.ro
> >
> >
>


[jQuery] Rotating CSS classes each 5 sec

2009-03-20 Thread Alexandru Dinulescu
Hello.

I have a huge question. I need something that rotates classes each 5 seconds
for ex

I have a  . I want each 5 seconds the class to be
changed from img1 to img2, and so on so at the start an array should be
placed like
imgArray = [ "img1" , "img2", "img3",  etc ]

I need css classes changed not a plain image since  the image is a
background image and i have text on it.

I did look over google but i couldnt find any help regarding this matter.

Thank you

---
Alexandru Dinulescu
Web Developer
(X)HTML/CSS Specialist
Expert Guarantee Certified Developer
XHTML: http://www.expertrating.com/transcript.asp?transcriptid=1879053
CSS : http://www.expertrating.com/transcript.asp?transcriptid=1870619
RentACoder Profile:
http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInfo.aspx?lngAuthorId=6995323

MainWebsite: http://alexd.adore.ro


[jQuery] Custom ScrollBar

2009-02-16 Thread Alexandru Dinulescu
Hello.

I am looking for a custom vertical scrollbar plugin. I want to put it in a
fluid width / height div, and so far i havent found anything. The only thing
i did found is jScrollpane which doesnt like to work with jquery 1.3.1 so if
anyone has any info please let me know.

Thanks

---
Alexandru Dinulescu
Web Developer
(X)HTML/CSS Specialist
Expert Guarantee Certified Developer
XHTML: http://www.expertrating.com/transcript.asp?transcriptid=1879053
CSS : http://www.expertrating.com/transcript.asp?transcriptid=1870619
RentACoder Profile:
http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInfo.aspx?lngAuthorId=6995323

MainWebsite: http://alexd.adore.ro
Portofolio: http://alexd.adore.ro/project_page.php


[jQuery] Re: New to JQuery, silly question.

2009-02-13 Thread Alexandru Dinulescu
Oh snap!

Thanks ...


---
Alexandru Dinulescu
Web Developer
(X)HTML/CSS Specialist
Expert Guarantee Certified Developer
XHTML: http://www.expertrating.com/transcript.asp?transcriptid=1879053
CSS : http://www.expertrating.com/transcript.asp?transcriptid=1870619
RentACoder Profile:
http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInfo.aspx?lngAuthorId=6995323

MainWebsite: http://alexd.adore.ro
Portofolio: http://alexd.adore.ro/project_page.php


On Thu, Feb 12, 2009 at 10:42 PM, Ricardo Tomasi wrote:

>
> li:last and li.last are not the same element.
>
> li.last is the  element, while li:last is
> giving you the *last* LI in the collection of *all* the LI's
> descending from ".leftNav ul" - that is the HAX li> element.
>
> Enforcing the child relationship should give you the expected results:
>
> $(".leftNav .menu > ul > li:last")[0] == $(".leftNav ul li.last")[0]
>
> cheers
> - ricardo
>
> On Feb 12, 4:56 pm, Alexandru Dinulescu  wrote:
> > Here is the Link of the page in question.
> >
> > THIS WORKS:http://alexd.adore.ro/projects/threadsmith/getIdeas.html
> >
> > $(document).ready(function(){
> >
> > if($(".leftNav ul li:last").height() < 32){
> > $(".leftNav ul li.last").addClass("lastWithItems");
> >
> > }
> >
> > })
> >
> > THIS DOESNT;http://alexd.adore.ro/projects/threadsmith/getIdeas2.html
> >
> > $(document).ready(function(){
> >
> > if($(".leftNav ul li:last").height() < 32){
> > $(".leftNav ul li:last").addClass("lastWithItems");
> >
> > }
> >
> > })
> >
> > THIS DOESNT ALSOhttp://
> alexd.adore.ro/projects/threadsmith/getIdeas3.html
> >
> > $(document).ready(function(){
> >
> > if($(".leftNav ul li.last").height() < 32){
> > $(".leftNav ul li:last").addClass("lastWithItems");
> >
> > }
> >
> > })
> >
> > ---
> > Alexandru Dinulescu
> > Web Developer
> > (X)HTML/CSS Specialist
> > Expert Guarantee Certified Developer
> > XHTML:http://www.expertrating.com/transcript.asp?transcriptid=1879053
> > CSS :http://www.expertrating.com/transcript.asp?transcriptid=1870619
> > RentACoder Profile:
> http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInf...
> >
> > MainWebsite:http://alexd.adore.ro
> > Portofolio:http://alexd.adore.ro/project_page.php
> >
> > On Thu, Feb 12, 2009 at 7:15 PM, Liam Potter  >wrote:
> >
> >
> >
> > > Hi Alexandru,
> >
> > > I cannot see any reason why li.last would not work, as it would be no
> > > different then selecting any li with any class.
> >
> > > Alexandru Dinulescu wrote:
> >
> > >> So this should work right?
> >
> > >> function blabla() {
> > >> }
> >
> > >> $(document).ready(blabla);
> >
> > >> ---
> >
> > >> Any info why the li:last and li.last do not work?
> >
> > >> the html was something like this
> > >> 
> > >>  Test Test Test 
> > >> Test Test Test 
> > >> Test Test Test 
> > >> 
> >
> > >> so li.last and li:last equal the same thing
> >
> > >> Thanks for all the info so far
> > >> ---
> > >> Alexandru Dinulescu
> > >> Web Developer
> > >> (X)HTML/CSS Specialist
> > >> Expert Guarantee Certified Developer
> > >> XHTML:http://www.expertrating.com/transcript.asp?transcriptid=1879053
> > >> CSS :http://www.expertrating.com/transcript.asp?transcriptid=1870619
> > >> RentACoder Profile:
> > >>http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInf.
> ..
> >
> > >> MainWebsite:http://alexd.adore.ro
> > >> Portofolio:http://alexd.adore.ro/project_page.php
> >
> > >> On Thu, Feb 12, 2009 at 6:38 PM, MorningZ  > >> morni...@gmail.com>> wrote:
> >
> > >>"So all the parantheses are where they belong.."
> >
> > >>you should not use () in the document.ready line
> >
> > >>$(document).ready(blabla())
> >
> > >>won't work
> >
> > >>$(document).ready(blabla)
> >
> > >>will work
> >
> > >>On Feb 12, 11:32 am, Alexandru Dinulescu  > >><mailto:a

[jQuery] Re: New to JQuery, silly question.

2009-02-12 Thread Alexandru Dinulescu
Here is the Link of the page in question.


THIS WORKS: http://alexd.adore.ro/projects/threadsmith/getIdeas.html

$(document).ready(function(){

if($(".leftNav ul li:last").height() < 32){
$(".leftNav ul li.last").addClass("lastWithItems");

}

})

THIS DOESNT; http://alexd.adore.ro/projects/threadsmith/getIdeas2.html

$(document).ready(function(){

if($(".leftNav ul li:last").height() < 32){
$(".leftNav ul li:last").addClass("lastWithItems");

}

})

THIS DOESNT ALSO http://alexd.adore.ro/projects/threadsmith/getIdeas3.html

$(document).ready(function(){

if($(".leftNav ul li.last").height() < 32){
$(".leftNav ul li:last").addClass("lastWithItems");

}

})






---
Alexandru Dinulescu
Web Developer
(X)HTML/CSS Specialist
Expert Guarantee Certified Developer
XHTML: http://www.expertrating.com/transcript.asp?transcriptid=1879053
CSS : http://www.expertrating.com/transcript.asp?transcriptid=1870619
RentACoder Profile:
http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInfo.aspx?lngAuthorId=6995323

MainWebsite: http://alexd.adore.ro
Portofolio: http://alexd.adore.ro/project_page.php


On Thu, Feb 12, 2009 at 7:15 PM, Liam Potter wrote:

>
> Hi Alexandru,
>
> I cannot see any reason why li.last would not work, as it would be no
> different then selecting any li with any class.
>
> Alexandru Dinulescu wrote:
>
>> So this should work right?
>>
>> function blabla() {
>> }
>>
>> $(document).ready(blabla);
>>
>> ---
>>
>> Any info why the li:last and li.last do not work?
>>
>> the html was something like this
>> 
>>  Test Test Test 
>> Test Test Test 
>> Test Test Test 
>> 
>>
>> so li.last and li:last equal the same thing
>>
>> Thanks for all the info so far
>> ---
>> Alexandru Dinulescu
>> Web Developer
>> (X)HTML/CSS Specialist
>> Expert Guarantee Certified Developer
>> XHTML: http://www.expertrating.com/transcript.asp?transcriptid=1879053
>> CSS : http://www.expertrating.com/transcript.asp?transcriptid=1870619
>> RentACoder Profile:
>> http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInfo.aspx?lngAuthorId=6995323
>>
>> MainWebsite: http://alexd.adore.ro
>> Portofolio: http://alexd.adore.ro/project_page.php
>>
>>
>> On Thu, Feb 12, 2009 at 6:38 PM, MorningZ > morni...@gmail.com>> wrote:
>>
>>
>>"So all the parantheses are where they belong.."
>>
>>you should not use () in the document.ready line
>>
>>
>>$(document).ready(blabla())
>>
>>won't work
>>
>>$(document).ready(blabla)
>>
>>will work
>>
>>
>>
>>
>>On Feb 12, 11:32 am, Alexandru Dinulescu ><mailto:alex.d.a...@gmail.com>>
>>wrote:
>>> Also i didnt say this
>>>
>>> I said
>>> function blabla() {
>>>
>>>
>>>
>>> > }
>>>
>>> > $(document).ready(blabla()) ?
>>>
>>> So all the parantheses are where they belong...
>>> ---
>>> Alexandru Dinulescu
>>> Web Developer
>>> (X)HTML/CSS Specialist
>>> Expert Guarantee Certified Developer
>>>
>>XHTML:http://www.expertrating.com/transcript.asp?transcriptid=1879053
>>> CSS :http://www.expertrating.com/transcript.asp?transcriptid=1870619
>>> RentACoder
>>    Profile:
>> http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInf...
>>>
>>> MainWebsite:http://alexd.adore.ro
>>> Portofolio:http://alexd.adore.ro/project_page.php
>>>
>>> On Thu, Feb 12, 2009 at 5:40 PM, MorningZ ><mailto:morni...@gmail.com>> wrote:
>>>
>>> > For the first part of your post
>>>
>>> > li:last   gets the last  in the given 
>>>
>>> > li.last   gets any  with the class of "last"
>>>
>>> > For the second part of your post, your syntax is wrong
>>>
>>> > $(document).ready(blabla)
>>>
>>> > (note the lack of () after the function name)
>>>
>>> > On Feb 12, 8:59 am, Alexandru Dinulescu ><mailto:alex.d.a...@gmail.com>> wrote:
>>> > > Why does this :
>>>
>>> > > $

[jQuery] Re: New to JQuery, silly question.

2009-02-12 Thread Alexandru Dinulescu
So this should work right?

function blabla() {
}

$(document).ready(blabla);

---

Any info why the li:last and li.last do not work?

the html was something like this

 Test Test Test 
Test Test Test 
Test Test Test 


so li.last and li:last equal the same thing

Thanks for all the info so far
---
Alexandru Dinulescu
Web Developer
(X)HTML/CSS Specialist
Expert Guarantee Certified Developer
XHTML: http://www.expertrating.com/transcript.asp?transcriptid=1879053
CSS : http://www.expertrating.com/transcript.asp?transcriptid=1870619
RentACoder Profile:
http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInfo.aspx?lngAuthorId=6995323

MainWebsite: http://alexd.adore.ro
Portofolio: http://alexd.adore.ro/project_page.php


On Thu, Feb 12, 2009 at 6:38 PM, MorningZ  wrote:

>
> "So all the parantheses are where they belong.."
>
> you should not use () in the document.ready line
>
>
> $(document).ready(blabla())
>
> won't work
>
> $(document).ready(blabla)
>
> will work
>
>
>
>
> On Feb 12, 11:32 am, Alexandru Dinulescu 
> wrote:
> > Also i didnt say this
> >
> > I said
> > function blabla() {
> >
> >
> >
> > > }
> >
> > > $(document).ready(blabla()) ?
> >
> > So all the parantheses are where they belong...
> > ---
> > Alexandru Dinulescu
> > Web Developer
> > (X)HTML/CSS Specialist
> > Expert Guarantee Certified Developer
> > XHTML:http://www.expertrating.com/transcript.asp?transcriptid=1879053
> > CSS :http://www.expertrating.com/transcript.asp?transcriptid=1870619
> > RentACoder Profile:
> http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInf...
> >
> > MainWebsite:http://alexd.adore.ro
> > Portofolio:http://alexd.adore.ro/project_page.php
> >
> > On Thu, Feb 12, 2009 at 5:40 PM, MorningZ  wrote:
> >
> > > For the first part of your post
> >
> > > li:last   gets the last  in the given 
> >
> > > li.last   gets any  with the class of "last"
> >
> > > For the second part of your post, your syntax is wrong
> >
> > > $(document).ready(blabla)
> >
> > > (note the lack of () after the function name)
> >
> > > On Feb 12, 8:59 am, Alexandru Dinulescu  wrote:
> > > > Why does this :
> >
> > > > $(document).ready(function(){
> >
> > > > if($(".leftNav ul li:last").height() < 32){
> > > > $(".leftNav ul li.last").addClass("lastWithItems");
> >
> > > > }
> >
> > > > })
> >
> > > > work in 1.3.1 but not this
> >
> > > > $(document).ready(function(){
> >
> > > > if($(".leftNav ul li.last").height() < 32){
> > > > $(".leftNav ul li.last").addClass("lastWithItems");
> >
> > > > }
> >
> > > > })
> >
> > > > (Notice the li.last on both lines) ??? Also why isnt it explained
> > > anywhere
> > > > :(
> >
> > > > Another thing
> >
> > > > why cant i do this
> >
> > > > function blabla() {
> >
> > > > }
> >
> > > > $(document).ready(blabla()) ?
> >
> > > > and i have to do $(document).ready(function(){})
> >
> > > > From what i recall i could do both things in 1.2.6, now with 1.3.1
> those
> > > > seem to be impossible, also why isnt there any mention on the Jquery
> > > > doc/tutorial pages? :(
> >
> > > > Thanks
> > > > ---
> > > > Alexandru Dinulescu
> > > > Web Developer
> > > > (X)HTML/CSS Specialist
> > > > Expert Guarantee Certified Developer
> > > > XHTML:
> http://www.expertrating.com/transcript.asp?transcriptid=1879053
> > > > CSS :http://www.expertrating.com/transcript.asp?transcriptid=1870619
> > > > RentACoder Profile:
> > >http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInf.
> ..
> >
> > > > MainWebsite:http://alexd.adore.ro
> > > > Portofolio:http://alexd.adore.ro/project_page.php
>


[jQuery] Re: New to JQuery, silly question.

2009-02-12 Thread Alexandru Dinulescu
Also i didnt say this

I said
function blabla() {
>
> }
>
> $(document).ready(blabla()) ?

So all the parantheses are where they belong...
---
Alexandru Dinulescu
Web Developer
(X)HTML/CSS Specialist
Expert Guarantee Certified Developer
XHTML: http://www.expertrating.com/transcript.asp?transcriptid=1879053
CSS : http://www.expertrating.com/transcript.asp?transcriptid=1870619
RentACoder Profile:
http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInfo.aspx?lngAuthorId=6995323

MainWebsite: http://alexd.adore.ro
Portofolio: http://alexd.adore.ro/project_page.php


On Thu, Feb 12, 2009 at 5:40 PM, MorningZ  wrote:

>
> For the first part of your post
>
> li:last   gets the last  in the given 
>
> li.last   gets any  with the class of "last"
>
> For the second part of your post, your syntax is wrong
>
> $(document).ready(blabla)
>
> (note the lack of () after the function name)
>
>
>
> On Feb 12, 8:59 am, Alexandru Dinulescu  wrote:
> > Why does this :
> >
> > $(document).ready(function(){
> >
> > if($(".leftNav ul li:last").height() < 32){
> > $(".leftNav ul li.last").addClass("lastWithItems");
> >
> > }
> >
> > })
> >
> > work in 1.3.1 but not this
> >
> > $(document).ready(function(){
> >
> > if($(".leftNav ul li.last").height() < 32){
> > $(".leftNav ul li.last").addClass("lastWithItems");
> >
> > }
> >
> > })
> >
> > (Notice the li.last on both lines) ??? Also why isnt it explained
> anywhere
> > :(
> >
> > Another thing
> >
> > why cant i do this
> >
> > function blabla() {
> >
> > }
> >
> > $(document).ready(blabla()) ?
> >
> > and i have to do $(document).ready(function(){})
> >
> > From what i recall i could do both things in 1.2.6, now with 1.3.1 those
> > seem to be impossible, also why isnt there any mention on the Jquery
> > doc/tutorial pages? :(
> >
> > Thanks
> > ---
> > Alexandru Dinulescu
> > Web Developer
> > (X)HTML/CSS Specialist
> > Expert Guarantee Certified Developer
> > XHTML:http://www.expertrating.com/transcript.asp?transcriptid=1879053
> > CSS :http://www.expertrating.com/transcript.asp?transcriptid=1870619
> > RentACoder Profile:
> http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInf...
> >
> > MainWebsite:http://alexd.adore.ro
> > Portofolio:http://alexd.adore.ro/project_page.php
>


[jQuery] Re: New to JQuery, silly question.

2009-02-12 Thread Alexandru Dinulescu
Yes

but in that case the last element is the one with the .last classname so
they are identical in meaning (they both refer to the same element) so why
it's not working ?
---
Alexandru Dinulescu
Web Developer
(X)HTML/CSS Specialist
Expert Guarantee Certified Developer
XHTML: http://www.expertrating.com/transcript.asp?transcriptid=1879053
CSS : http://www.expertrating.com/transcript.asp?transcriptid=1870619
RentACoder Profile:
http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInfo.aspx?lngAuthorId=6995323

MainWebsite: http://alexd.adore.ro
Portofolio: http://alexd.adore.ro/project_page.php


On Thu, Feb 12, 2009 at 5:40 PM, MorningZ  wrote:

>
> For the first part of your post
>
> li:last   gets the last  in the given 
>
> li.last   gets any  with the class of "last"
>
> For the second part of your post, your syntax is wrong
>
> $(document).ready(blabla)
>
> (note the lack of () after the function name)
>
>
>
> On Feb 12, 8:59 am, Alexandru Dinulescu  wrote:
> > Why does this :
> >
> > $(document).ready(function(){
> >
> > if($(".leftNav ul li:last").height() < 32){
> > $(".leftNav ul li.last").addClass("lastWithItems");
> >
> > }
> >
> > })
> >
> > work in 1.3.1 but not this
> >
> > $(document).ready(function(){
> >
> > if($(".leftNav ul li.last").height() < 32){
> > $(".leftNav ul li.last").addClass("lastWithItems");
> >
> > }
> >
> > })
> >
> > (Notice the li.last on both lines) ??? Also why isnt it explained
> anywhere
> > :(
> >
> > Another thing
> >
> > why cant i do this
> >
> > function blabla() {
> >
> > }
> >
> > $(document).ready(blabla()) ?
> >
> > and i have to do $(document).ready(function(){})
> >
> > From what i recall i could do both things in 1.2.6, now with 1.3.1 those
> > seem to be impossible, also why isnt there any mention on the Jquery
> > doc/tutorial pages? :(
> >
> > Thanks
> > ---
> > Alexandru Dinulescu
> > Web Developer
> > (X)HTML/CSS Specialist
> > Expert Guarantee Certified Developer
> > XHTML:http://www.expertrating.com/transcript.asp?transcriptid=1879053
> > CSS :http://www.expertrating.com/transcript.asp?transcriptid=1870619
> > RentACoder Profile:
> http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInf...
> >
> > MainWebsite:http://alexd.adore.ro
> > Portofolio:http://alexd.adore.ro/project_page.php
>


[jQuery] New to JQuery, silly question.

2009-02-12 Thread Alexandru Dinulescu
Why does this :

$(document).ready(function(){

if($(".leftNav ul li:last").height() < 32){
$(".leftNav ul li.last").addClass("lastWithItems");

}

})


work in 1.3.1 but not this

$(document).ready(function(){

if($(".leftNav ul li.last").height() < 32){
$(".leftNav ul li.last").addClass("lastWithItems");

}

})

(Notice the li.last on both lines) ??? Also why isnt it explained anywhere
:(

Another thing

why cant i do this

function blabla() {
}

$(document).ready(blabla()) ?

and i have to do $(document).ready(function(){})

>From what i recall i could do both things in 1.2.6, now with 1.3.1 those
seem to be impossible, also why isnt there any mention on the Jquery
doc/tutorial pages? :(

Thanks
---
Alexandru Dinulescu
Web Developer
(X)HTML/CSS Specialist
Expert Guarantee Certified Developer
XHTML: http://www.expertrating.com/transcript.asp?transcriptid=1879053
CSS : http://www.expertrating.com/transcript.asp?transcriptid=1870619
RentACoder Profile:
http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInfo.aspx?lngAuthorId=6995323

MainWebsite: http://alexd.adore.ro
Portofolio: http://alexd.adore.ro/project_page.php