$(function(){ $.ajax({ url: '/includes/sociala_media/ajax/facebook.asp', cache: false, dataType: "html", async: true, success: function(data) { $("#facebook .content").html(data); addCufon(); }, error: function() { $("#facebook .content .information").html("Begäran gjorde timeout"); } }); $.ajax({ url: '/includes/sociala_media/ajax/youtube.asp', cache: false, dataType: "html", async: true, success: function(data) { $("#youtube .content").html(data); makeYoutubeLinks(); addCufon(); }, error: function() { $("#youtube .content .information").html("Begäran gjorde timeout"); } }); $.ajax({ url: '/includes/sociala_media/ajax/bloggar.asp', cache: false, dataType: "html", async: true, success: function(data) { $("#bloggar .content").html(data); addCufon(); }, error: function() { $("#bloggar .content .information").html("Begäran gjorde timeout"); } }); makeYoutubeLinks(); makeSMNavigation(); }); function makeYoutubeLinks() { $(".lightbox_youtube").colorbox({ iframe: true, innerWidth:"640px", innerHeight:"480px" }); } function addCufon() { Cufon.replace('.navigation a, .name', { hover: true, fontFamily: 'Univers LT' }); } function makeSMNavigation() { $(".btn_prev").click(function() { var target = "#" + $(this).parent().parent().attr("id"); $(target + " .content .data:first").hide(); var movePost = $(target + " .content .data:last"); $(target + " .content .data:last").remove(); $(movePost).prependTo($(target + " .content")); $(target + " .content .data:first").show(); makeYoutubeLinks(); return false; }); $(".btn_next").click(function() { var target = "#" + $(this).parent().parent().attr("id"); var movePost = $(target + " .content .data:first"); $(target + " .content .data:first").remove(); $(movePost).appendTo($(target + " .content")); $(target + " .content .data:last").hide(); $(target + " .content .data:first").show(); makeYoutubeLinks(); return false; }); }