I have a div that on click moves to the right, and then on click again and it goes back to the left (its a newsletter pop-out). Everything is working perfectly in Safari and Chrome, however in Firefox and IE it will only open, it won't close when you click again. I am using .bind() and .unbind() Any suggestions? I am using jQuery version 1.3.2.
FF Error : NS_ERROR_XPC_BAD_CONVERT_JS: Could not convert JavaScript argument arg 0 [nsIDOMWindow.getComputedStyle]
IE Error: SCRIPT16386: No such interface supported
Javascript:
$(function () {
$('.newsletter').bind('click.open', open)
$(window).resize(function () {
var wWth = $(window).innerWidth(),
wHgt = $(window).innerHeight();
$('#overflow').fadeIn('slow').css({
width: wWth,
height: wHgt
});
});
});
function open() {
var overflow = $('<div id="overflow"><div>');
$(this).stop().animate({
left: '-35'
}, 650);
if ($('#overflow').length < 1) {
$('body').append(overflow);
}
var wWth = $(window).innerWidth(),
wHgt = $(window).innerHeight();
$('#overflow').fadeIn('slow').css({
width: wWth,
height: wHgt
});
$('.newsletter').unbind('click.open').bind('click.close', close)
}
function close(e) {
if ($(e.target).is('input')) return;
$('#overflow').fadeOut('slow')
$('.newsletter').stop().animate({
left: '-390px'
}, 650);
$('.newsletter').unbind('click.close').bind('click.open', open)
}
HTML
<div class="newsletter_signup">
<div id="newslettertext1">
Newsletter bestellen<br>
<br>
Lassen Sie sich per Newsletter über Neuheiten und <br>
Aktionen von Tempur informieren. Jetzt anmelden
</div>
<div id="signup">
<form id="leftnewsletter" action="" method="get">
<input type="email" name="email" id="emailsignup" placeholder="E-MAIL ADDRESS" style="margin-left:76px; margin-top:16px; width:187px;">
<input type="submit" name="signupbtn" id="signupbtn" value="SIGN UP" class="signupbutton">
</form>
</div>
<div id="newslettertext2">
*Sie können jederzeit Ihre Einwilligung zum Erhalt des<br>
Newsletters zurückziehen und sich abmelden.
</div>