jQuery global event

Simple and easy. Took me about 5 minutes to figure that jQuery could do this.

$("#A").on("click", function(){
    $(document).trigger("custom");
});
$(document).on("custom", function(e){
    $("#B").removeClass("hidden");
});
$(document).on("custom", function(e){
    alert("something");
});

Best to namespace events, use jQuery’s namespacing or on your own (examples below).

I used it for something more like this:

$(document).trigger('paymentmethod:successfulSave');
$(document).trigger('paymentmethod:cancel');

$(document).on('paymentmethod:successfulSave', function(){
    console.log('save');
    //refresh payment methods
});

$(document).on('paymentmethod:cancel', function(){
    console.log('cancel');
});

http://stackoverflow.com/questions/23782786/jquery-trigger-custom-global-event

Continue reading jQuery global event

Bootstrap 3 and IE8 support

Even though its a small amount of the global traffic some applications (especially in the financial worlds) need to support IE8 due to the user base.

There is some push and pull on this, but sometimes you can’t force someone to do something good for themselves.

But you still need to work with them. So what do you do?

After some searching, I found this with the shim answer (below) combined with the standard bootstrap suggested ie-edge tag.

<meta http-equiv="X-UA-Compatible" content="IE=edge">

[Make Bootstrap IE8 compatible](https://teamtreehouse.com/forum/how-can-i-make-bootstrap-3-compatible-with-ie8″>Make Bootstrap IE8 compatible)

You definitely need to know your user base before making decisions on technology. Don’t just look at analytics data on the % but also what will it take to make it work and whats the value of that 3% of customers.

Even a small user base could be the difference on being in the red or black (in either direction of “support”).

With tools like the shim, it makes the decision easier to at least make the site respond and function 80% of the way.

Keeping clean coding and testing code on the older browsers could be the difference of a few lines of code and still supporting some legacy browsers and making a happy customer.
Continue reading Bootstrap 3 and IE8 support