2013-06-30, 23:42:22
(2013-06-30, 16:39:54)giggty Wrote: hello !
love your plugin !
i just have a little quation ...
what if i wanted to "toggle" the form from an outside ID click event,
like from a <a> tag...
10x ! great plugin !
Nevermind cracked it....
if anybody ever wondered how to do this it's really simple :
look at the default plugin code :
Code:
//show / hide function
$('div#contactable, #contactablea').toggle(function() {
$('#overlay').css({display: 'block'});
$('div#contactable').animate({"marginRight": "-=5px"}, "fast");
$('#contactForm').animate({"marginRight": "-=0px"}, "fast");
$('div#contactable').animate({"marginRight": "+=387px"}, "slow");
$('#contactForm').animate({"marginRight": "+=390px"}, "slow");
},
function() {
$('#contactForm').animate({"marginRight": "-=390px"}, "slow");
$('div#contactable').animate({"marginRight": "-=387px"}, "slow").animate({"marginRight": "+=5px"}, "fast");
$('#overlay').css({display: 'none'});
});
**now just change "this" to 'div#contactable' and add another ID as following:
Code:
//show / hide function
$('div#contactable, #contactablea').toggle(function() {
$('#overlay').css({display: 'block'});
$('div#contactable').animate({"marginRight": "-=5px"}, "fast");
$('#contactForm').animate({"marginRight": "-=0px"}, "fast");
$('div#contactable').animate({"marginRight": "+=387px"}, "slow");
$('#contactForm').animate({"marginRight": "+=390px"}, "slow");
},
function() {
$('#contactForm').animate({"marginRight": "-=390px"}, "slow");
$('div#contactable').animate({"marginRight": "-=387px"}, "slow").animate({"marginRight": "+=5px"}, "fast");
$('#overlay').css({display: 'none'});
});
then just stick the id to the a href tag :
example :
Code:
<a id="contactablea" href="#">link name</a>
hope this helps some1