当前使用可联系并触发以下内容:
$('#my-contact-div').contactable({
subject: 'feedback URL:'+location.href,
header: '',
url: 'mail.php',
name: 'Name',
email: 'Email',
message : 'Message',
submit : 'SEND',
recievedMsg : 'Thank you for your message',
notRecievedMsg : 'Sorry but your message could not be sent, try again later',
footer: 'Please feel free to get in touch, we value your feedback',
hideOnSubmit: true
});
但是,我希望能够在单击不同的 div 时滑动打开此表单区域。当 .contactable 脚本附加到 #my-contact-div
运行时,我需要模拟对该 div
的点击吗?
例如,在另一个名为 .linkClick
的 div
上,这样当单击它时,它会注册为被单击的 #my-contact-div
.
最佳答案
通过使用以下内容更改 js 文件对其进行排序:
jQuery('#contactable-inner').toggleClick(function() {
jQuery('#contactable-overlay').css({display: 'block'});
jQuery(this).animate({"marginRight": "-=5px"}, "2000");
jQuery('#contactable-contactForm').animate({"marginRight": "-=0px"}, "2000");
jQuery(this).animate({"marginRight": "+=387px"}, "4000");
jQuery('#contactable-contactForm').animate({"marginRight": "+=390px"}, "4000");
}
至
jQuery('#contactable-inner,.formLink').toggleClick(function() {
jQuery('#contactable-overlay').css({display: 'block'});
jQuery('#contactable-inner').animate({"marginRight": "-=5px"}, "2000");
jQuery('#contactable-contactForm').animate({"marginRight": "-=0px"}, "2000");
jQuery('#contactable-inner').animate({"marginRight": "+=387px"}, "4000");
jQuery('#contactable-contactForm').animate({"marginRight": "+=390px"}, "4000");
}
关于javascript - 模拟不同div的点击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40021760/