oscarviedma

ScrollBoster horizontal divi

Sep 24th, 2020
529
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. <script src="https://unpkg.com/scrollbooster@2/dist/scrollbooster.min.js"></script>
  2.  
  3. <script>
  4. // Encerrar un div dentro de otro
  5. jQuery(function($){
  6. $( ".content-inner" ).wrapAll( "<div class='content' />");
  7. });
  8. </script>
  9.  
  10. <script>
  11. // ScrollBoster
  12. const scrollHorizontalAnuncios = () => {
  13. new ScrollBooster({
  14. viewport: document.querySelector(".viewport"),
  15. content: document.querySelector(".content"),
  16. scrollMode: "transform",
  17. direction: "horizontal",
  18. });
  19. };
  20.  
  21.  
  22. // Inicializar ScrollBoster
  23. if (window.innerWidth > 768) {
  24. function initScroll() {
  25. scrollHorizontalAnuncios();
  26. }
  27.  
  28. if (document.readyState !== "loading") {
  29. initScroll();
  30. } else {
  31. document.addEventListener("DOMContentLoaded", initScroll);
  32. }
  33. }
  34. </script>
  35.  
Add Comment
Please, Sign In to add comment