Atlantic.displayRandomElement('#header li.business .sponsored-dropdown-item');
Derek Thompson
- Derek Thompson is a senior editor at The Atlantic, where he oversees business coverage for the website.
More
Derek has also written for Slate, BusinessWeek, and the Daily Beast. He has appeared as a guest on radio and television networks, including NPR, the BBC, CNBC, and MSNBC.
All Posts
RSS feed
Share
Share on facebook
Share on linkedin
Share on twitter
«
Previous Thompson
Email
Print
Close
function plusOneCallback () {
$(document).trigger('share');
}
$(document).ready(function() {
var iframeUrl = "\/ad\/thanks-iframe\/TheAtlanticOnline\/channel_business;src=blog;by=derek-thompson;title=the-irrational-consumer-why-economics-is-dead-wrong-about-how-we-make-choices;pos=sharing;sz=640x480,336x280,300x250";
var toolsClicked = false;
$('#toolsTop').click(function() {
toolsClicked = 'top';
});
$('#toolsBottom').click(function() {
toolsClicked = 'bottom';
});
$('#thanksForSharing a.hide').click(function() {
$('#thanksForSharing').hide();
});
var onShareClickHandler = function() {
var top = parseInt($(this).css('top').replace(/px/, ''), 10);
toolsClicked = (top > 600) ? 'bottom' : 'top';
};
var onIframeReady = function(iframe) {
var win = iframe.contentWindow;
// Don't show the box if there's no ad in it
if (win.$('.ad').children().length == 1) {
return;
}
var visibleAds = win.$('.ad').filter(function() {
return !($(this).css('display') == 'none');
});
if (visibleAds.length == 0) {
// Ad is hidden, so don't show
return;
}
if (win.$('.ad').hasClass('adNotLoaded')) {
// Ad failed to load so don't show
return;
}
$('#thanksForSharing').css('display', 'block');
var top;
if(toolsClicked == 'bottom' && $('#toolsBottom').length) {
top = $('#toolsBottom')[0].offsetTop + $('#toolsBottom').height() - 310;
} else {
top = $('#toolsTop')[0].offsetTop + $('#toolsTop').height() + 10;
}
$('#thanksForSharing').css('left', (-$('#toolsTop').offset().left + 60) + 'px');
$('#thanksForSharing').css('top', top + 'px');
};
var onShare = function() {
// Close "Share successful!" AddThis plugin popup
if (window._atw && window._atw.clb && $('#at15s:visible').length) {
_atw.clb();
}
if (iframeUrl == null) {
return;
}
$('#thanksForSharingIframe').attr('src', "\/ad\/thanks-iframe\/TheAtlanticOnline\/channel_business;src=blog;by=derek-thompson;title=the-irrational-consumer-why-economics-is-dead-wrong-about-how-we-make-choices;pos=sharing;sz=640x480,336x280,300x250");
$('#thanksForSharingIframe').load(function() {
var iframe = this;
var win = iframe.contentWindow;
if (win.loaded) {
onIframeReady(iframe);
} else {
win.$(iframe.contentDocument).ready(function() {
onIframeReady(iframe);
})
}
});
};
if (window.addthis) {
addthis.addEventListener('addthis.ready', function() {
$('.articleTools .share').mouseover(function() {
$('#at15s').unbind('click', onShareClickHandler);
$('#at15s').bind('click', onShareClickHandler);
});
});
addthis.addEventListener('addthis.menu.share', function(evt) {
onShare();
});
}
// This 'share' event is used for testing, so one can call
// $(document).trigger('share') to get the thank you for
// sharing box to appear.
$(document).bind('share', function(event) {
onShare();
});
if (!window.FB || (window.FB && !window.FB._apiKey)) {
// Hook into the fbAsyncInit function and register our listener there
var oldFbAsyncInit = (window.fbAsyncInit) ? window.fbAsyncInit : (function() { });
window.fbAsyncInit = function() {
oldFbAsyncInit();
FB.Event.subscribe('edge.create', function(response) {
// to hide the facebook comments box
$('#facebookLike span.fb_edge_comment_widget').hide();
onShare();
});
};
} else if (window.FB) {
FB.Event.subscribe('edge.create', function(response) {
// to hide the facebook comments box
$('#facebookLike span.fb_edge_comment_widget').hide();
onShare();
});
}
});
The Irrational Consumer: Why Economics Is Dead Wrong About How We Make Choices
By Derek Thompson
he