Pricing Blog

How to fire an event based on screen width

  • yoelfdz-1212440397033242695

    yoelfdz

    1 year ago

    Hey there, I have an event that opens a chatbot on load, I want to disable this for mobile users. Not finding how, has anyone done anything similar?
  • Tod-1212440398899974167

    Tod

    1 year ago

    Great energy @! Your continuous contribution to the toddle Community just made you advance to Community Level 6!
  • patrickmast-1258643791468953654

    Patrick Mast

    1 year ago

    Great question! 😉
  • lucasg-1258763633547149342

    Lucas G

    1 year ago

    How is the chatbot loaded? You could maybe do it via the standard viewport controls where if under 767px display: none
  • lucasg-1258773468527460385

    Lucas G

    1 year ago

    Or if your chatbot is loaded via a custom action, you could implement a check within it to not trigger if under a certain size
  • return window.innerWidth >= 767
  • This would return true/false