Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * jQuery Plugin : jConfirmAction
- *
- * by Hidayat Sagita
- * http://www.webstuffshare.com
- * Licensed Under GPL version 2 license.
- *
- * callback added by Manuel Joao Silva
- *
- */
- (function($){
- jQuery.fn.jConfirmAction = function (options, callback) {
- // Some jConfirmAction options (limited to customize language) :
- // question : a text for your question.
- // yesAnswer : a text for Yes answer.
- // cancelAnswer : a text for Cancel/No answer.
- var theOptions = jQuery.extend ({
- question: "Are You Sure ?",
- yesAnswer: "Yes",
- cancelAnswer: "Cancel"
- }, options);
- return this.each (function () {
- $(this).bind('click', function(e) {
- e.preventDefault();
- if($(this).next('.question').length <= 0)
- {
- $(this).after('<div class="jConfirmAction_question">'+theOptions.question+'<br/> <span class="jConfirmAction_yes">'+theOptions.yesAnswer+'</span><span class="jConfirmAction_cancel">'+theOptions.cancelAnswer+'</span></div>');
- }
- $(this).next('.jConfirmAction_question').animate({opacity: 1}, 300);
- $('.jConfirmAction_yes').bind('click', jQuery.proxy(callback, this));
- $('.jConfirmAction_yes').bind('click',function(){
- $(this).parents('.jConfirmAction_question').fadeOut(300, function() {
- $(this).remove();
- });
- });
- $('.jConfirmAction_cancel').bind('click', function(){
- $(this).parents('.jConfirmAction_question').fadeOut(300, function() {
- $(this).remove();
- });
- });
- });
- });
- }
- })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement