Simple webcast property binding, through the button to find out how many pictures I am and how the property binding is realized.

in anniuzhi [I] .zz = I, I don"t understand how to bind it to the first picture. What is the purpose of using this?


Mar.19,2021

is actually quite simple. Let me give you an example. Words like this are usually done by binding data-id on an element. In fact, it doesn't matter where the attribute is bound, what matters is how to set the property to make it easier for you to use, not necessarily the same as others.

$('.target-li').on("mouseover",function(){
    var $id = $(this).attr("data-id"); //
    //$id
    doSomething($id);
});

Line 117, zz is tied to the button. When the event is triggered, read zz to know how many it is


We know that the for loop is global, because there are many ways to broadcast pictures. Again, I'll use my method to help you interpret it:
olis [0] .className = "current";

  //
  for(var j=0;j<olis.length;jPP){
      //j  10  
    olis[j].index=j;
      olis[j].onclick=function(){
          //j
          //olis[i]j                     
          for(var i=0;i<olis.length;iPP){
              olis[i].className="";//className
              ulis[i].style.display="none";// 
          }
          olis[this.index].className="current";//className 
          //ulis
          ulis[this.index].style.display="block";//  
          count=this.index;//count
          console.log(this.index);//this.index 
      }
  }

this should be this part of the content, if you don't use this here, because we are looping to each bound click event, the landlord can try to see the print result at the end of the console.log code. If we assign the subscript of each element to the index attribute of arr [I] before, we can solve the problem caused by the subscript loop through the attribute value.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eac016-47e73.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eac016-47e73.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?