JavaScript Resize Height Issue -
im stuck on javascript issue, have no thought how resolve.
i have contact modal within blog: http://www.northernvirginiapaintingcontractor.com/blog click "send page"
when click on see issue. contact modal doesn't open of way.
compare same "send page" button on parent application functions normal. http://www.northernvirginiapaintingcontractor.com
this utilizes modified version of eric martin's simple modal.
the contact.js modified enable dynamic height, as, several different contact modals utilized same script.
3 other .js files include: actual.js jquery-easing-1.3.pack.js jquery-easing-compatibility.1.2.pack.js
here contact.js has problem: don't have slightest clue, if else great.
jquery(function ($) { var contact = { message: null, init: function () { $('#contact-form input.contact, a.contact').click(function (e) { e.preventdefault(); // create 1stmodal dialog info $('#modal-contact-form').modal({ closehtml: "<a href='#' title='close' class='modal-close'>close pager modal</a>", //maxheight: 62, //maxwidth: 62, //minheight: 62, //minwidth: 62, position: [98, 377], //autoposition: false, autoresize: true, //overlayid: 'contact-overlay', containerid: 'contact-container', containercss: { 'width': '350px'}, onopen: contact.open, onshow: contact.show, onclose: contact.close }); }); $('#contact-form input.suportecontacto, a.suportecontacto').click(function (e) { e.preventdefault(); // create 2nd modal dialog info $('#modal-soporte-form').modal({ closehtml: "<a href='#' title='close' class='modal-close'>close ticket modal</a>", //maxheight: 62, //maxwidth: 62, //minheight: 62, //minwidth: 62, position: [98, 377], //autoposition: false, autoresize: true, //overlayid: 'contact-overlay', containerid: 'contact-container', containercss: { 'width': '350px' }, onopen: contact.open, onshow: contact.show, onclose: contact.close }); }); $('#contact-indivform input.indivcontacto, a.indivcontacto').click(function (e) { e.preventdefault(); // create 3rd modal dialog info $('#modal-indivcontact-form').modal({ closehtml: "<a href='#' title='close' class='modal-close'>close contacto modal</a>", //maxheight: 62, //maxwidth: 62, //minheight: 62, //minwidth: 62, position: [98, 377], //autoposition: false, autoresize: true, //overlayid: 'contact-overlay', containerid: 'contact-container', containercss: { 'width': '350px' }, onopen: contact.open, onshow: contact.show, onclose: contact.close }); }); $('#headlogin').click(function (e) { e.preventdefault(); // create login modal $('#login_form').modal({ closehtml: "<a href='#' title='cerrar' class='modal-close' style='padding-right:15px'>cerrar login modal</a>", //maxheight: 62, //maxwidth: 62, //minheight: 62, //minwidth: 62, position: [110, 364], //autoposition: false, autoresize: true, //overlayid: 'contact-overlay', containerid: 'contact-container', containercss: { 'width': '310px' }, onopen: contact.open, onshow: contact.login, onclose: contact.close }); }); }, open: function (dialog) { $('#ajax_loading').hide(); $('.simplemodal-wrap').css('overflow-x', 'visible').css('overflow-y', 'visible'); // add together padding buttons in firefox/mozilla if ($.browser.mozilla) { $('#contact-container .contact-button').css({ 'padding-bottom': '2px' }); } // input field font size if ($.browser.safari) { $('#contact-container .contact-input').css({ 'font-size': '.9em' }); } // dynamically determine modal height //var h = 280; //var h = 220; //if ($('#contact-subject').length) { // h += 26; //} //if ($('#contact-cc').length) { // h += 22; //} var h = $('#contact-container form').actual('outerheight') + 30; var title = $('#contact-container .contact-title').html(); $('#contact-container .contact-title').html('loading...'); dialog.overlay.fadein(200, function () { dialog.container.fadein(200, function () { dialog.data.fadein(200, function () { $('#contact-container .contact-content').animate({ height: h }, function () { $('#contact-container .contact-title').html(title); $('#contact-container form').fadein(200, function () { $('#contact-container #contact-name').focus(); $('#contact-container .contact-cc').click(function () { var cc = $('#contact-container #contact-cc'); cc.is(':checked') ? cc.attr('checked', '') : cc.attr('checked', 'checked'); }); // prepare png's ie 6 if ($.browser.msie && $.browser.version < 7) { $('#contact-container .contact-button').each(function () { if ($(this).css('backgroundimage').match(/^url[("']+(.*\.png)[)"']+$/i)) { var src = regexp.$1; $(this).css({ backgroundimage: 'none', filter: 'progid:dximagetransform.microsoft.alphaimageloader(src="' + src + '", sizingmethod="crop")' }); } }); } }); }); }); }); }); }, login: function() { $('#contact-container .contact-send').click(function (e) { e.preventdefault(); // hide 'submit' button if (contact.validatelogin()) { $('.contact-send').hide(); $('.contact-cancel').hide(); // show gif spinning rotator $('#ajax_loading').show(); // 'this' refers current submitted form var url =''; var str = $('#frmlogin').serialize(); var path = window.location.pathname; var sub = 'account'; if(path.touppercase().indexof(sub.touppercase()) != -1) { url = 'login.aspx'; var image = $('#ajax_loading img'); image.attr('src','../images/spinner.gif'); } else { url = 'account/login.aspx'; } // -- start ajax phone call -- var form = $('#status form'); $.ajax({ type: "post", //url: form[0].action, url: url, data: str, success: function (msg) { $("#status").ajaxcomplete(function (event, request, settings) { // show 'submit' button $('.contact-send').show(); $('.contact-cancel').show(); // hide gif spinning rotator $('#ajax_loading').hide(); if (msg != 'false') // login ok? { var login_response = '<div style="color:green; margin: 1px; float: right; width: 300px;">ya estás conectado!<br />por favor, espera mientras estas redirigido...</div>'; $('.contact-title').hide(); $('a.modalcloseimg').hide(); $('#frmlogin').hide(); $('#simplemodal-container').css("width", "500px"); $('#simplemodal-container').css("height", "140px"); $('#login_form .contact-message').html(login_response).show(); // refers 'status' // after 1 sec redirect logged-in user settimeout(contact.redirect, 500); } else // error? { $('#login_form .contact-content').css("height", "150px"); $('#login_form .contact-message').html("login failed!").css('color','red').show(); } }); } }); } // -- end ajax phone call -- else { if ($('#login_form .contact-message:visible').length > 0) { var msg = $('#login_form .contact-message div'); msg.fadeout(200, function () { msg.empty(); contact.showerror(); msg.fadein(200); }); } else { $('#login_form .contact-message').animate({ height: '30px' }, contact.showerror); } } }); }, redirect: function() { window.location = '/'; // members area }, show: function (dialog) { $('#contact-container .contact-send').click(function (e) { e.preventdefault(); var form = $('#contact-container form'); // validate form if (contact.validate()) { var msg = $('#contact-container .contact-message'); msg.fadeout(function () { msg.removeclass('contact-error').empty(); }); $('#contact-container .contact-title').html('sending...'); $('#contact-container form').fadeout(200); $('#contact-container .contact-content').animate({ height: '80px' }, function () { var uname = $('#contact-container #contact-name').val(); var email = $('#contact-container #contact-email').val(); var cntx = $('#contact-container #contact-message').val(); var docc = "false"; if ($('#contact-container #contact-cc').is(':checked')) { docc = "true"; } $.ajax({ url: "blog/api/blogs.asmx/sendmail", data: "{'uname':'" + uname + "', 'email':'" + email + "','cntx':'" + cntx + "','docc':'" + docc + "'}", type: "post", contenttype: "application/json", success: function (msg) { //contact.close(dialog); $('#contact-container .contact-loading').fadeout(200, function () { $('#contact-container .contact-title').html('thank you!'); msg.html(data).fadein(200); settimeout(function () { contact.close(dialog); }, 1500); }); } }); contact.close(dialog); }); } else { if ($('#contact-container .contact-message:visible').length > 0) { var msg = $('#contact-container .contact-message div'); msg.fadeout(200, function () { msg.empty(); contact.showerror(); msg.fadein(200); }); } else { $('#contact-container .contact-message').animate({ height: '30px' }, contact.showerror); } } }); }, close: function (dialog) { $('#contact-container .contact-message').fadeout(); $('#contact-container .contact-title').html('closing...'); $('#contact-container form').fadeout(200); $('#contact-container .contact-content').animate({ height: 40 }, function () { dialog.data.fadeout(200, function () { dialog.container.fadeout(200, function () { dialog.overlay.fadeout(200, function () { $.modal.close(); }); }); }); }); }, error: function (xhr) { alert(xhr.statustext); }, validatelogin: function () { contact.message = ''; if (!$('#username').val()) { contact.message += 'user name required. '; } var pass = $('#password').val(); if (!pass) { contact.message += 'password required. '; } if (contact.message.length > 0) { homecoming false; } else { homecoming true; } }, validate: function () { contact.message = ''; if (!$('#contact-container input[name="name"]').val()) { contact.message += 'name required. '; } var email = $('#contact-container input[name="email"]').val(); if (!email) { contact.message += 'email required. '; } else { if (!contact.validateemail(email)) { contact.message += 'email invalid. '; } } if (!$('#contact-container textarea[name="message"]').val()) { contact.message += 'message required.'; } if (contact.message.length > 0) { homecoming false; } else { homecoming true; } }, validateemail: function (email) { var @ = email.lastindexof("@"); // create sure @ (@) sybmol exists , // not first or lastly character if (at < 1 || (at + 1) === email.length) homecoming false; // create sure there aren't multiple periods if (/(\.{2,})/.test(email)) homecoming false; // break local , domain portions var local = email.substring(0, at); var domain = email.substring(at + 1); // check lengths if (local.length < 1 || local.length > 64 || domain.length < 4 || domain.length > 255) homecoming false; // create sure local , domain don't start or end period if (/(^\.|\.$)/.test(local) || /(^\.|\.$)/.test(domain)) homecoming false; // check quoted-string addresses // since allowed in quoted-string address, // we're going allow them go through if (!/^"(.+)"$/.test(local)) { // it's dot-string address...check valid characters if (!/^[-a-za-z0-9!#$%*\/?|^{}`~&'+=_\.]*$/.test(local)) homecoming false; } // create sure domain contains valid characters , @ to the lowest degree 1 period if (!/^[-a-za-z0-9\.]*$/.test(domain) || domain.indexof(".") === -1) homecoming false; homecoming true; }, showerror: function () { $('#contact-container .contact-message') .html($('<div class="contact-error"></div>').append(contact.message)) .fadein(200); } }; contact.init(); });
this:
$('.contact-send').hide(); $('.contact-cancel').hide();
add's display:none; elements , aren't removed when phone call "open"
javascript
No comments:
Post a Comment