Jump to content

Calling a javascript function


jamjam

Recommended Posts

Hi

 

This is very silly question, but can someone please tell what is wrong.

 

I have a small piece of javascript code

 

Here it is.

 

google.load("jquery", "1.3.1"); 
jQuery.fn.fadeToggle = function(speed, easing, callback) { 
  return this.animate({opacity: 'toggle'}, speed, easing, callback);   
}; 

$(document).ready(function() { 
    $('#tellfriend').hide(); 
      $('li a.email, #tellfriend a.close').click(function() { 
    $("#tellfriend").fadeToggle('slow'); 
  }); 
   
}); 

Once a email icon button is clicked this code fades in a email form.

 

The associated html looks like this

 

<li><a class="email" href="#tellafreiend" alt="Email" id="emails">Email</a></li> 

This all works.

 

 

But I need to change the associated html to something like this

 

 

 

<li><a href="#tellafreiend" alt="Email"><img src="/files/email.png" alt="Email"/></a></li> 

However once I do this the fade in effect no longer works and I do not see the email form.

 

I know the problem is properly a result of incorrect class or id.

But I cannot fix it.

 

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/219998-calling-a-javascript-function/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.