Jump to content

Dismissible Element


Recommended Posts

  • 2 weeks later...

Hi! Check this out:

;( function($, _, undefined){
	"use strict";
	
	ips.controller.register('plugins.globalMessageDismiss', {
	
		initialize: function () {
			this.on( document, 'click', '[data-action="dismiss"]', this.dismiss );
		},
		
		dismiss: function (e) {
			e.preventDefault();
			var url = $( e.currentTarget ).attr('href');
			var message = $(this.scope);
			
			ips.getAjax()(url).done(function(){
				ips.utils.anim.go( 'fadeOut', message );
			}).fail(function(){
				window.location = url;
			});
		}

	});
}(jQuery, _));

 

Link to comment
Share on other sites

11 hours ago, SeNioR- said:

Hi! Check this out:

;( function($, _, undefined){
	"use strict";
	
	ips.controller.register('plugins.globalMessageDismiss', {
	
		initialize: function () {
			this.on( document, 'click', '[data-action="dismiss"]', this.dismiss );
		},
		
		dismiss: function (e) {
			e.preventDefault();
			var url = $( e.currentTarget ).attr('href');
			var message = $(this.scope);
			
			ips.getAjax()(url).done(function(){
				ips.utils.anim.go( 'fadeOut', message );
			}).fail(function(){
				window.location = url;
			});
		}

	});
}(jQuery, _));

 

Thanks! Will look at this after I get some coffee in me.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Upcoming Events

    No upcoming events found
×
×
  • Create New...