Jquery toggle with two elements
Posted
by Jesse
on Stack Overflow
See other posts from Stack Overflow
or by Jesse
Published on 2010-06-09T15:44:00Z
Indexed on
2010/06/09
16:22 UTC
Read the original article
Hit count: 209
I am using a toggle on a graphic to slide out a contact form. The problem is, the contact form can cover up the graphic element on low resolutions. I thought a solution would be to include a "close this" inside the form, that would use the same toggle effect. When I add the close this element to the code, instead of working in tandem with the original graphic element, it starts the chain back over, and slides the contact form even further out.
Site is here: http://www.tritonloyaltysupport.com/status
Code for toggle here:
$(this).html(div_form);
//show / hide function
$('div.contactable').toggle(
function() {
$('#overlay').css({display: 'block'});
$('#contactForm').animate({"marginRight": "-=0px"}, "fast");
$('#contactForm').animate({"marginRight": "+=390px"}, "slow");
},
function() {
$('#contactForm').animate({"marginRight": "-=390px"}, "slow");
$('#overlay').css({display: 'none'});
}
);
© Stack Overflow or respective owner