Guest User

Untitled

a guest
May 25th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. function _News() {
  2. //Hash for the URL and Onload Event
  3. var hash = window.location.hash.substr(1);
  4.  
  5.  
  6. var href = $('.news-list-item a').each(function(){
  7. var href = $(this).attr('href');
  8. if(hash==href){
  9. alert ('success');
  10. var toLoad = hash+'#col6 .news-single-item';
  11. }
  12. else{
  13. alert ('error');
  14. //var toLoad = $('.news-list-item a:first').attr('href')+'#col6 .news-single-item';
  15. }
  16. $('#col8').addClass('loading');
  17. $('#col8 p').fadeOut('fast');
  18. showContent(toLoad);
  19. });
  20. //Onclick get the Content
  21. /*
  22. $('.news-list-item a').click(function() {
  23. var toLoad = $(this).attr('href')+'#col6 .news-single-item';
  24. $('#col8').addClass('loading');
  25. $('#col8 p').fadeOut('fast');
  26. window.location.hash = $(this).attr('href');
  27. showContent(toLoad);
  28. return false;
  29. });
  30. */
  31. //Show Content
  32. function showContent(toLoad) {
  33. $('.news-single-item').remove();
  34. $("<div class='news-single-item'></div>").css('display','none').appendTo('#col8');
  35. $('.news-single-item').load(toLoad,function() {
  36. $('#col8').removeClass('loading');
  37. $('.news-single-item').fadeIn('slow');
  38. });
  39. }
  40. }
Add Comment
Please, Sign In to add comment