0

How can I change the duration for screens above 767px to '15000' and screens below 768px to '5000'?

jQuery(document).ready(function($) {
$('.marquee_text,.marquee_text_banner').marquee({
    direction: 'left',
    duration: 5000,
    gap: 0,
    delayBeforeStart: 0,
    duplicated: true,
    startVisible: true
});
gjjr
  • 607
  • 5
  • 13
  • what duration? marquee speed or? – Hanna Rose Aug 11 '21 at 10:24
  • @HannaRose I think he talks about duration: 5000, – Carsten Løvbo Andersen Aug 11 '21 at 10:26
  • maybe you can find the solution at here : https://stackoverflow.com/questions/10547797/very-simple-very-smooth-javascript-marquee – Hanna Rose Aug 11 '21 at 10:30
  • @CarstenLøvboAndersen thats right, currently the duration is 5000, but I want to make the duration 5000 on mobile (< 768px), and 15000 for anything above that. – gjjr Aug 11 '21 at 10:32
  • @gjjr If you want to detect mobile, and not by screen width then try something like `duration: ( /Android|webOS|iPhone|iPad|Mac|Macintosh|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ? 5000 : 15000)`. It's a guess but maybe it will work – Carsten Løvbo Andersen Aug 11 '21 at 10:35
  • @CarstenLøvboAndersen Thanks but i need to detect screen size as if i just use 5000, its too fast on larger screens, if i use 15000, then its too slow on smaller screens. It doesnt matter whether its mobile or not just big or small screens. – gjjr Aug 11 '21 at 10:38
  • 1
    @gjjr then try `duration: ($(window).width() < 768 ? 5000 : 15000)` – Carsten Løvbo Andersen Aug 11 '21 at 10:40
  • yes perfect! Thanks @CarstenLøvboAndersen – gjjr Aug 11 '21 at 10:51

0 Answers0