Dynamic Add virtual box (hint with:) (click on the content when there is a virtual box hint, point down when there are hints, but are to click on the first add)

Source: Internet
Author: User

Code:

/**
* Detect the first empty space without a click
*
**/
function CheckStatus (m) {//++ (m = 0 as defined above)

var slots = Document.queryselectorall (". Slot");

var statusement = Document.queryselector (". slot[data-ind= '" + (M + 1) + "']");//slot for the next index

for (var i = 0; i < slots.length; i++) {
Miglobals.removeclass (Slots[i], "Freom");//move out of the Freom added in the previous slot
};

if (statusement) {//
if (Statusement.getattribute ("data-status") = = "n") {//data-status is a property value, when empty in the slot Data-status = n is added Freom
Miglobals.addclass (statusement, "Freom");
}else{
Comparearray ();//* gets the minimum value of NUM, and then adds the Freom class name
}

}



}
/**
* Get the minimum value of num and add the Freom class name.
* Added to the current click in the package function
**/
function Comparearray () {

var num=[];//creating an array
var slots = Document.queryselectorall (". slot[data-status= ' n ')");//Get all slots with a property value of [data-status= ' n ']
for (var i = 0; i < slots.length; i++) {//looping through the contents of the slot is the number of empty times
Miglobals.removeclass (Slots[i], "Freom");//move out of Freom in the slot
Num[i] = Slots[i].getattribute ("Data-ind");//bar The value of the property that is traversed into the data-ind to this array

};

var index = Math.min.apply (null, num);//Gets the minimum value in the array
var indexement = Document.queryselector (". slot[data-ind= '" + Index + "']");//Gets the smallest slot in the array to add Freom
Miglobals.addclass (indexement, "Freom");
}

Dynamic Add virtual box (hint with:) (click on the content when there is a virtual box hint, point down when there are hints, but are to click on the first add)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.