mardi 30 janvier 2018

why not working function javascript resize ?

My code javascript not working. I want the functions work if will be over 500px width screen.

<ul>
  <li class="da">Dawid</li>
  <li class="pi">Piotr</li>
  <li class="to">Tomek</li>
</ul>

AND JAVASCRIPT CODE- NOT WORKING

document.getElementById("dawid").addEventListener("click",displaytwo);
document.getElementById("piotrek").addEventListener("click",displayone);



function displaytwo(){

                    document.getElementById("piotrek").style.display='none';
                    document.getElementById("tomek").style.display='none';
                                }

function displayone(){
                    document.getElementById("dawid").style.display='none';
                    document.getElementById("tomek").style.display='none';
          }  

RESIZE NOT WORKING

function screen_resize(){
var w = parseInt(window.innerWidth);
   if(w > 500)
   { 

     displaytwo();
     displayone();
   }}
$(window).resize(function(e) {
screen_resize();
});

$(document).ready(function(e) {
    screen_resize();
});

Aucun commentaire:

Enregistrer un commentaire