Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. $('.showtext').text($('.hiddentext').first('td:first').text());
  2.  
  3. $('.showtext').html($('.highlighted .hiddentext').html());
  4.  
  5. $('.showtext').html($nextCol.find('.hiddentext').html());
  6. $('.showtext').html($prevCol.find('.hiddentext').html());
  7.  
  8. var $currCol = $('.highlighted'); //to get the current column
  9. $('.race strong').text($currCol.closest('.highlighted').first('td:first').text());
  10.  
  11. $('.showtext').text($('.hiddentext').first('td:first').text());
  12.  
  13. $('.showtext').text($nextCol.find('.hiddentext').text());
  14.  
  15. $('.showtext').html($nextCol.find('.hiddentext').html());
  16.  
  17. <td class="visible" id="r2">
  18. <span class="hiddentext">Race 2<br />Santa Fe 12:00</span>
  19. <strong><a href="#" title="Race number 1">R2</a></strong>
  20. </td>
  21.  
  22. <td class="visible" id="r2" data-text="Race 2<br />Santa Fe 12:00">
  23. <a href="#" title="Race number 1">R2</a>
  24. </td>
  25.  
  26. var hiddenText = $nextCol.data("text");
  27.  
  28. $(".next").click(function(e){
  29. e.preventDefault();
  30. var $nextCol = $('.highlighted').next('td');
  31. MoveCursor($nextCol, 'next');
  32. });
  33.  
  34. $(".previous").click(function(e){
  35. e.preventDefault();
  36. var $prevCol = $('.highlighted').prev('td');
  37. MoveCursor($prevCol, 'prev');
  38. });
  39.  
  40. function MoveCursor(col, side) {
  41.  
  42. var maxCol = 8;
  43.  
  44. if((side === 'next' && col.length != 0) ||
  45. (side == 'prev' && col.length != 0 && col.index() >= maxCol)) {
  46.  
  47. $('.highlighted').removeClass("highlighted");
  48. col.addClass("highlighted");
  49.  
  50. // show current title
  51. $('.showtext').html(col.data('text'));
  52.  
  53. if (col.hasClass("invisible")) {
  54. col.removeClass("invisible");
  55. col.addClass("visible");
  56.  
  57. var $toRem;
  58.  
  59. if(side == 'prev')
  60. $toRem = col.next('td').next('td').next('td').next('td').next('td').next('td');
  61. else
  62. $toRem = $nextCol.prev('td').prev('td').prev('td').prev('td').prev('td').prev('td');
  63.  
  64. $toRem.removeClass("visible");
  65. $toRem.addClass("invisible");
  66. }
  67. }
  68. }
  69.  
  70. $('.showtext').html($currCol.find('span.hiddentext').html());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement