случай: http://santz.net/index.contacto.html
цель: «Веб -сайт» должен открыть диалог/модальное окно/модальное окно после успешной формы. Окно не открывается (редко, оно открывается, если вы делаете еще один щелчок ...) < /p>
Идея довольно проста! Когда пользователь представляет форму, диалог мгновенно появляется!
Mensaje
скрипт и прикрепленные сценарии
$(function() {
$('#contact-form').submit(function() {
$.ajax({
type: "POST",
url: $(this).attr('action'),
data: $(this).serialize(),
success: function() {
$('#popup-wrapper').modalPopLite({
openButton: '#clicker',
closeButton: '#close-btn'
});
}
});
$('#contact-form')[0].reset();
return false;
});
});
Скрипт модального ящика (тот, который поставлялся с плагином, который я использую: http://mywebdeveloperblog.com/my-jquery ... dalpoplite)
>>(function ($) {
var popID = 0;
$.fn.modalPopLite = function (options) {
var options = $.extend({}, { openButton: "modalPopLite-open-btn", closeButton: "modalPopLite-close-btn", isModal: false, callBack: null }, options);
return this.each(function () {
popID++;
var thisPopID = popID;
var isOpen = false;
obj = $(this);
triggerObj = options.openButton;
closeObj = options.closeButton;
isReallyModel = options.isModal;
//alert("winH: " + winH + "top: " + top + "objH: " + objH);
obj.before('');
obj.wrap('');
obj.addClass('modalPopLite-child-' + thisPopID);
$(triggerObj).live("click", function (e) {
e.preventDefault();
var winW = $(window).width();
var winH = $(window).height();
var objW = $('.modalPopLite-child-' + thisPopID).outerWidth();
var objH = $('.modalPopLite-child-' + thisPopID).outerHeight();
var left = (winW / 2) - (objW / 2);
var top = (winH / 2) - (objH / 2);
$('#modalPopLite-mask' + thisPopID).css('height', winH + "px");
$('#modalPopLite-mask' + thisPopID).fadeTo('slow', 0.6);
//$('#modalPopLite-wrapper' + thisPopID).hide();
$('#modalPopLite-wrapper' + thisPopID).css({ 'left': left + "px", 'top': top });
$('#modalPopLite-wrapper' + thisPopID).fadeIn('slow');
isOpen = true;
});
$(closeObj).live("click", function (e) {
e.preventDefault();
$('#modalPopLite-mask' + thisPopID).hide();
//$('#modalPopLite-wrapper' + thisPopID).hide();
$('#modalPopLite-wrapper' + thisPopID).css('left', "-10000px");
isOpen = false;
if (options.callBack != null) {
options.callBack.call(this);
}
});
//if mask is clicked
if (!isReallyModel) {
$('#modalPopLite-mask' + thisPopID).click(function (e) {
e.preventDefault();
$(this).hide();
//$('#modalPopLite-wrapper' + thisPopID).hide();
$('#modalPopLite-wrapper' + thisPopID).css('left', "-10000px");
isOpen = false;
if (options.callBack != null) {
options.callBack.call(this);
}
});
}
$(window).resize(function () {
if (isOpen) {
var winW = $(window).width();
var winH = $(window).height();
var objW = $('.modalPopLite-child-' + thisPopID).outerWidth();
var objH = $('.modalPopLite-child-' + thisPopID).outerHeight();
var left = (winW / 2) - (objW / 2);
var top = (winH / 2) - (objH / 2);
$('#modalPopLite-wrapper' + thisPopID).css({ 'left': left + "px", 'top': top });
}
});
});
};
$.fn.modalPopLite.Close = function (id) {
$('#modalPopLite-mask' + id).hide();
//$('#modalPopLite-wrapper' + id).hide();
$('#modalPopLite-wrapper' + thisPopID).css('left', "-10000px");
if (options.callBack != null) {
options.callBack.call(this);
}
};
$.fn.modalPopLite.ShowProgress = function () {
$('').appendTo("body")
};
$.fn.modalPopLite.HideProgress = function () {
$('.popBox-ajax-progress').remove();
};
})(jQuery);
php
alert('Gracias por contactarse, en breve, me pondre en contacto.\n\nSantz Design | www.santz.net');
window.location = 'index.contacto.html';
alert('El envio fallo. Por favor, envie un mail directamente a info@santz.net');
window.location = 'index.contacto.html';
Подробнее здесь: https://stackoverflow.com/questions/152 ... on-success
Финал: Ajax/jQuery/PHP. Представление формы и модальная коробка открыта на успехе ⇐ Jquery
Программирование на jquery
1757295637
Anonymous
[b] случай: [/b] http://santz.net/index.contacto.html
[b] цель: [/b] «Веб -сайт» должен открыть диалог/модальное окно/модальное окно после успешной формы. Окно не открывается (редко, оно открывается, если вы делаете еще один щелчок ...) < /p>
[b] Идея довольно проста! Когда пользователь представляет форму, диалог мгновенно появляется!
Mensaje
скрипт и прикрепленные сценарии [/b]
$(function() {
$('#contact-form').submit(function() {
$.ajax({
type: "POST",
url: $(this).attr('action'),
data: $(this).serialize(),
success: function() {
$('#popup-wrapper').modalPopLite({
openButton: '#clicker',
closeButton: '#close-btn'
});
}
});
$('#contact-form')[0].reset();
return false;
});
});
[b] Скрипт модального ящика (тот, который поставлялся с плагином, который я использую: http://mywebdeveloperblog.com/my-jquery-plugins/modalpoplite)[/b]
>>(function ($) {
var popID = 0;
$.fn.modalPopLite = function (options) {
var options = $.extend({}, { openButton: "modalPopLite-open-btn", closeButton: "modalPopLite-close-btn", isModal: false, callBack: null }, options);
return this.each(function () {
popID++;
var thisPopID = popID;
var isOpen = false;
obj = $(this);
triggerObj = options.openButton;
closeObj = options.closeButton;
isReallyModel = options.isModal;
//alert("winH: " + winH + "top: " + top + "objH: " + objH);
obj.before('');
obj.wrap('');
obj.addClass('modalPopLite-child-' + thisPopID);
$(triggerObj).live("click", function (e) {
e.preventDefault();
var winW = $(window).width();
var winH = $(window).height();
var objW = $('.modalPopLite-child-' + thisPopID).outerWidth();
var objH = $('.modalPopLite-child-' + thisPopID).outerHeight();
var left = (winW / 2) - (objW / 2);
var top = (winH / 2) - (objH / 2);
$('#modalPopLite-mask' + thisPopID).css('height', winH + "px");
$('#modalPopLite-mask' + thisPopID).fadeTo('slow', 0.6);
//$('#modalPopLite-wrapper' + thisPopID).hide();
$('#modalPopLite-wrapper' + thisPopID).css({ 'left': left + "px", 'top': top });
$('#modalPopLite-wrapper' + thisPopID).fadeIn('slow');
isOpen = true;
});
$(closeObj).live("click", function (e) {
e.preventDefault();
$('#modalPopLite-mask' + thisPopID).hide();
//$('#modalPopLite-wrapper' + thisPopID).hide();
$('#modalPopLite-wrapper' + thisPopID).css('left', "-10000px");
isOpen = false;
if (options.callBack != null) {
options.callBack.call(this);
}
});
//if mask is clicked
if (!isReallyModel) {
$('#modalPopLite-mask' + thisPopID).click(function (e) {
e.preventDefault();
$(this).hide();
//$('#modalPopLite-wrapper' + thisPopID).hide();
$('#modalPopLite-wrapper' + thisPopID).css('left', "-10000px");
isOpen = false;
if (options.callBack != null) {
options.callBack.call(this);
}
});
}
$(window).resize(function () {
if (isOpen) {
var winW = $(window).width();
var winH = $(window).height();
var objW = $('.modalPopLite-child-' + thisPopID).outerWidth();
var objH = $('.modalPopLite-child-' + thisPopID).outerHeight();
var left = (winW / 2) - (objW / 2);
var top = (winH / 2) - (objH / 2);
$('#modalPopLite-wrapper' + thisPopID).css({ 'left': left + "px", 'top': top });
}
});
});
};
$.fn.modalPopLite.Close = function (id) {
$('#modalPopLite-mask' + id).hide();
//$('#modalPopLite-wrapper' + id).hide();
$('#modalPopLite-wrapper' + thisPopID).css('left', "-10000px");
if (options.callBack != null) {
options.callBack.call(this);
}
};
$.fn.modalPopLite.ShowProgress = function () {
$('').appendTo("body")
};
$.fn.modalPopLite.HideProgress = function () {
$('.popBox-ajax-progress').remove();
};
})(jQuery);
[b] php [/b]
alert('Gracias por contactarse, en breve, me pondre en contacto.\n\nSantz Design | www.santz.net');
window.location = 'index.contacto.html';
alert('El envio fallo. Por favor, envie un mail directamente a info@santz.net');
window.location = 'index.contacto.html';
Подробнее здесь: [url]https://stackoverflow.com/questions/15237989/final-ajax-jquery-php-form-submission-and-modal-box-open-on-success[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия