Loading articles dynamically on page change
One big step to opimize your code is to cache your jQuery objects.

var $layer = $('#layer');


You can also chain your method calls

$layer.css({ height: '30px' }).fadeIn(300).append('&lt;span&gt;hi&lt;/span&gt;');


Also, make use of context

var $layerLoading = $('.layerLoading');
$layerLoading.fadeOut("slow",function(){
  //$(".layerloading").remove();
    // instead do - this refers to the context which is '.layerloading' in this case
  $(this).remove();   
});