Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FadeOut for same link that was clicked
- function myalert() {
- var result = true;
- //var hide = $('.alert').fadeOut(100);
- //var css = $('#appriseOverlay').css('display','none');
- var $alertDiv = $('<div class="alert">Do you want to delete this item?<button class="ok">ok</button><button class="cancel">cancel</button></div>');
- $('body').append($alertDiv);
- $('.ok').click(function () {
- $('.alert').fadeOut(100);
- $('#appriseOverlay').css('display', 'none');
- callback(true);
- });
- $('.cancel').click(function () {
- $('.alert').fadeOut(100);
- $('#appriseOverlay').css('display', 'none');
- callback(false);
- });
- $alertDiv.fadeIn(100);
- $('#appriseOverlay').css('display', 'block');
- return result;
- };
- $('.iu').click(myalert)
- function callback(result) {
- //
- if (result) {
- $(this).fadeOut('slow');//I mean, this part from code
- } else {
- alert('no')
- }
- }
- function myalert() {
- var result = true;
- //var hide = $('.alert').fadeOut(100);
- //var css = $('#appriseOverlay').css('display','none');
- var $alertDiv = $('<div class="alert">Do you want to delete this item?<button class="ok">ok</button><button class="cancel">cancel</button></div>');
- var link = this; //save the clicks link
- $('body').append($alertDiv);
- $('.ok').click(function () {
- $('.alert').fadeOut(100);
- $('#appriseOverlay').css('display', 'none');
- callback(true, link); //pass along the clicked link
- });
- $('.cancel').click(function () {
- $('.alert').fadeOut(100);
- $('#appriseOverlay').css('display', 'none');
- callback(false, link);
- });
- $alertDiv.fadeIn(100);
- $('#appriseOverlay').css('display', 'block');
- return result;
- };
- $('.iu').click(myalert)
- function callback(result, link) {
- if (result) {
- $(link).fadeOut('slow');//fade out the clicked link
- } else {
- alert('no')
- }
- }
- // pass e (the event object to "myalert")
- function myalert(e) {
- var result = true;
- //var hide = $('.alert').fadeOut(100);
- //var css = $('#appriseOverlay').css('display','none');
- var $alertDiv = $('<div class="alert">Do you want to delete this item?<button class="ok">ok</button><button class="cancel">cancel</button></div>');
- $('body').append($alertDiv);
- $('.ok').click(function () {
- $('.alert').fadeOut(100);
- $('#appriseOverlay').css('display','none');
- // pass the clicked element to the callback function
- callback(true, e.target);
- });
- $('.cancel').click(function () {
- $('.alert').fadeOut(100);
- $('#appriseOverlay').css('display','none');
- // pass the clicked element to the callback function
- callback(false, e.target);
- });
- $alertDiv.fadeIn(100);
- $('#appriseOverlay').css('display','block');
- return result;
- };
- $('.iu').click(myalert) // the event object will be passed to myalert
- // takes the result, and the clicked element
- function callback(result, el) {
- //
- if(result){
- $(el).fadeOut('slow');
- }else{
- alert('no')
- }
- }
Add Comment
Please, Sign In to add comment