[jQuery] Re: How to add some string in attributes?

2009-10-07 Thread Teddy

Thanks Liam Potter...

I want this becoz my case in Drupal case... :D

If u know about primary link drupal based on link...
So I override that link became image link based on title link...

If I use css... I must add some line css for that link when I add some
link in Drupal

On Oct 6, 5:10 pm, Liam Potter radioactiv...@gmail.com wrote:
 $(function(){
         $(img).hover(
                 function(){
                         src = $(this).attr(src);
                         var newSrc = src.replace(/.png/, -hover.png);
                         $(this).attr(src,newSrc);
                 },
                 function(){
                         var newSrc = src.replace(/-hover.png/, .png);
                         $(this).attr(src,src);
                 }
         );

 });

 This is untested and certainly not the best way to do this (like I said 
 earlier). You should be using CSS for image rollovers.

 Teddy wrote:
  I mean not like that...

  I mean what ever the src value I want toaddhover when it hover
  and when mouse out I want delete that hover..

  img alt=My Account src=/images/whatever.png/

  and when hover that image I want became like this

  img alt=My Account src=/images/whatever-hover.png/

  and when mouse out that image became
  img alt=My Account src=/images/whatever.png/

  On Sep 28, 9:38 pm, Liam Potter radioactiv...@gmail.com wrote:

  $(function(){
          $(img).bind(mouseover,function(){
                  $(this).attr(src,/images/menu-my-account-hover.png);
          });

  });

  but this is the worst way you can do rollovers. You should be doing this 
  in pure CSS, and the best way would be to use an image sprite.

  Teddy Hong wrote:

  If I have a tag image like this..

  img alt=My Account src=/images/menu-my-account.png/

  and when hover that image I want became like this

  img alt=My Account src=/images/menu-my-account-hover.png/

  How to code this with jquery?

  Thanks


[jQuery] Re: How to add some string in attributes?

2009-10-06 Thread Teddy

I mean not like that...

I mean what ever the src value I want to add hover when it hover
and when mouse out I want delete that hover..

img alt=My Account src=/images/whatever.png/

and when hover that image I want became like this

img alt=My Account src=/images/whatever-hover.png/

and when mouse out that image became
img alt=My Account src=/images/whatever.png/


On Sep 28, 9:38 pm, Liam Potter radioactiv...@gmail.com wrote:
 $(function(){
         $(img).bind(mouseover,function(){
                 $(this).attr(src,/images/menu-my-account-hover.png);
         });

 });

 but this is the worst way you can do rollovers. You should be doing this in 
 pure CSS, and the best way would be to use an image sprite.

 Teddy Hong wrote:
  If I have a tag image like this..

  img alt=My Account src=/images/menu-my-account.png/

  and when hover that image I want became like this

  img alt=My Account src=/images/menu-my-account-hover.png/

  How to code this with jquery?

  Thanks


[jQuery] Re: How to add some string in attributes?

2009-10-06 Thread Liam Potter


$(function(){
   $(img).hover(
function(){
src = $(this).attr(src);
var newSrc = src.replace(/.png/, -hover.png);
$(this).attr(src,newSrc);
},
function(){
var newSrc = src.replace(/-hover.png/, .png);
$(this).attr(src,src);
}
);
});

This is untested and certainly not the best way to do this (like I said 
earlier). You should be using CSS for image rollovers.


Teddy wrote:

I mean not like that...

I mean what ever the src value I want to add hover when it hover
and when mouse out I want delete that hover..

img alt=My Account src=/images/whatever.png/

and when hover that image I want became like this

img alt=My Account src=/images/whatever-hover.png/

and when mouse out that image became
img alt=My Account src=/images/whatever.png/


On Sep 28, 9:38 pm, Liam Potter radioactiv...@gmail.com wrote:
  

$(function(){
$(img).bind(mouseover,function(){
$(this).attr(src,/images/menu-my-account-hover.png);
});

});

but this is the worst way you can do rollovers. You should be doing this in 
pure CSS, and the best way would be to use an image sprite.

Teddy Hong wrote:


If I have a tag image like this..
  
img alt=My Account src=/images/menu-my-account.png/
  
and when hover that image I want became like this
  
img alt=My Account src=/images/menu-my-account-hover.png/
  
How to code this with jquery?
  
Thanks
  




[jQuery] Re: How to add some string in attributes?

2009-09-28 Thread Liam Potter


$(function(){
$(img).bind(mouseover,function(){
$(this).attr(src,/images/menu-my-account-hover.png);
});
});

but this is the worst way you can do rollovers. You should be doing this in 
pure CSS, and the best way would be to use an image sprite.


Teddy Hong wrote:

If I have a tag image like this..

img alt=My Account src=/images/menu-my-account.png/

and when hover that image I want became like this

img alt=My Account src=/images/menu-my-account-hover.png/

How to code this with jquery?

Thanks