Guest User

Untitled

a guest
Jan 16th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. .pagination li {
  2. &:first-child,
  3. &.active-sibling,
  4. &.active,
  5. &.active + li,
  6. &:last-child {
  7. display: inline-block !important;
  8. }
  9. // There are >= 7 pages
  10. &:first-child:nth-last-child(n+8) {
  11. $how-many-on-ends: 5; // 1,2,3,4,5,...,10 || 1,...6,7,8,9,10
  12. &~li {
  13. // Start out with all siblings hidden
  14. display: none;
  15. // Show ellipsis before the previous one
  16. &.active-sibling:before {
  17. @include ellipsis(true);
  18. }
  19. // Show ellipsis after the next one
  20. &.active + li:after {
  21. @include ellipsis(false);
  22. }
  23. // Show the last children in the list by default
  24. &:nth-last-child(-n+#{$how-many-on-ends}) {
  25. display: inline-block;
  26. }
  27. // The child at the beginning of the last group shows ellipsis for the group
  28. &:nth-last-child(#{$how-many-on-ends}) {
  29. &:before {
  30. @include ellipsis(true);
  31. }
  32. }
  33. // The very beginning elements do not need to show ellipsis
  34. &:nth-child(-n+#{$how-many-on-ends - 3}), // The very end elements do not need to show ellipsis
  35. &:nth-last-child(-n+#{$how-many-on-ends - 3}), // Even if it's a sibling to "active"
  36. &.active-sibling:nth-last-child(-n+#{$how-many-on-ends - 1}) {
  37. &:before,
  38. &:after {
  39. display: none !important;
  40. }
  41. }
  42. }
  43. &.active,
  44. &~li.active {
  45. // Hide the last group if "active" comes before them
  46. &~li:nth-last-child(-n+#{$how-many-on-ends}) {
  47. display: none;
  48. // If there is overlap, the element will show, but hide it's ellipsis
  49. &:before {
  50. display: none;
  51. }
  52. }
  53. // Show the first group together if "active" comes before them
  54. &~li:nth-child(-n+#{$how-many-on-ends}) {
  55. display: inline-block;
  56. }
  57. // If "active" is before the last member in the group, don't show ellipsis
  58. &~li:nth-child(-n+#{$how-many-on-ends - 1}) {
  59. &:after {
  60. display: none;
  61. }
  62. }
  63. // The child at the end of the first group shows ellipsis for the group
  64. &~li:nth-child(#{$how-many-on-ends}) {
  65. &:after {
  66. @include ellipsis(false);
  67. }
  68. }
  69. // "active" should never show ellipsis
  70. &:before,
  71. &:after {
  72. display: none;
  73. }
  74. }
  75. }
  76. }
Add Comment
Please, Sign In to add comment