Hello,

This is my first time posting and I will start off by saying that I am not a
very good Javascript programmer.

I have some code that work fine in Firefox.  It makes a answer appear below
a question on an FAQ page.  The html structure is that there is an H5 tag
with a class of question followed by a div tag with a class of answer. 
Clicking on the H5 tag will make the div below slideDown and highlight
(using Interface Animate color).  When the HTML page loads the questions and
answers are there and javascript makes the answers disappear, so that the
page will be OK if Javascript is not enabled.  I also javascript for a hover
state on the H5 tags.

In IE the answers disappear, the hover works - but when you click on an H5
tag the answer div slidesDown and highlights, but then slidesUp right away. 
It appears that it is firing the faqCollapse function right after the
faqExpand function.  If I comment out the $(this).bind line this behavior
does not happen, but then I can not collapse a question.

There is probably an easy answer, but I do not know it.

Any help will be appreciated.

John Mason

$(function(){
function faqExpand(){
$(this).find("img").attr("src","http://www.ptclinic.com/faq/minus.gif";);
$(this).next().slideDown("normal").animateColor(1500,
{backgroundColor:['#ff0','#fff']});
$(this).unbind("click");
$(this).bind("click",faqCollapse);
$(this).attr("title","Collapse Answer");
return false;
}
function faqCollapse(){
$(this).find("img").attr("src","http://www.ptclinic.com/faq/plus.gif";);
$(this).next().slideUp("normal");
$(this).unbind("click").bind("click",faqExpand);
$(this).attr("title","Expand Answer");
return false;
}
//alert("Somthing");
$(".question").bind("click",faqExpand);
$(".faqanswer").hide();
$(".question").hover(function(){$(this).addClass("over");},function(){$(this).removeClass("over");});
$("#faqTitle").after("<h5 style='text-align:center;'>(Click on a Question to
view the Answer)</h5>");
});
-- 
View this message in context: 
http://www.nabble.com/Bind-causes-function-to-fire-IE-tf3145010.html#a8718242
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to