How to make a clickable block only on the mobile version?

  • 0

    Please tell me how to resolve the following question:

    I have a slider with news cards.

    The card has a clickable title, clickable categories and tags

    How to make the entire block clickable on the mobile version and lead to the full news page (The link in the title)?
    JavaScript Madeline Reeves, Apr 15, 2020

  • 1 Answers
  • 0
    Everything is easy and simple.

    Call the event on click:

    const toAll = () => {
    let platform = navigator.userAgent // это будет наша платформа
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera
    Mini/i.test(platform) {
    alert("Вы используете мобильное устройство (телефон или планшет).")
    // действие если мобильное устройство
    Piper Duarte

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!