私信  •  关注

Cristiano Soares

Cristiano Soares 最近创建的主题
Cristiano Soares 最近回复了

如果你想去看电影:

$(document).ready(function() {
    'use strict';
  
    const addresses = [
      {
        codes: [49, 97],
        path: '/'
      },
      {
        codes: [50, 98],
        path: '/escolas'
      },
      {
        codes: [51, 99],
        path: '/noticias'
      },
      {
        codes: [52, 100],
        path: '/eventos'
      },
      {
        codes: [52, 101],
        path: '/contato'
      }
    ]
    $(document).on("keyup", evt => {
      const key =  evt.which;
      addresses.map(address => {
        if(address.codes.filter(code => code === key).length)
          window.location.href = address.path;
      })
  });
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>