javascript - Extend the time duration in my jquery popup window -
i have jquery pop plugin, when submit form close automatically. need set time limit pop window.
html:
<div class='popbox'> <a class='open' href='#'> <img src='plus.png' style='width:14px;position:relative;'> click here! </a> <div class='collapse'> <div class='box'> <div class='arrow'></div> <div class='arrow-border'></div> <form action="" method="post" id="subform"> <div class="input"> <input type="text" name="cm-name" id="name" placeholder="name" /> </div> <div class="input"> <input type="text" name="cm-nklki-nklki" id="nklki-nklki" placeholder="email" /> </div> <div class="input"> <textarea name="cm-f-tlhll" id="message" placeholder="comments"></textarea> </div> <input type="submit" value="get in touch" /> <a href="#" class="close">cancel</a> <input type="button" name="closebutton" id="closebutton" value="closebutton" > </form> </div> </div>
jquery:
(function () { $.fn.popbox = function (options) { var settings = $.extend({ selector: this.selector, open: '.open', box: '.box', arrow: '.arrow', arrow_border: '.arrow-border', close: '.close' }, options); var methods = { open: function (event) { event.preventdefault(); var pop = $(this); var box = $(this).parent().find(settings['box']); if (box.css('display') == 'block') { methods.delay(1500).close(); } else { box.css({ 'display': 'block', 'top': 10, 'left': ((pop.parent().width() / 2) - box.width() / 2) }); } }, close: function () { $(settings['box']).fadeout("fast"); } }; $(document).bind('keyup', function (event) { if (event.keycode == 27) { methods.delay(1500).close(); } }); homecoming this.each(function () { //$(this).css({'width': $(settings['box']).width()}); // width needs set otherwise popbox not move when window resized. $(settings['open'], this).bind('click', methods.open); $(settings['open'], this).parent().find(settings['close']).bind('click', function (event) { event.preventdefault(); methods.close(); }); }); } }).call(this);
increase delay(1500)
higher value. 1500 in milliseconds, means current popup close in 1.5 seconds.
javascript jquery
No comments:
Post a Comment