I just made a game like whack a mole to in which the blocks gets highlighted at the specified time and the user keeps on clicking on the blocks.Once 10 successful clicks are made, the game ends. The problem is that the game works in chrome but not in jsfiddle.
The main problem is with the code below
var addCss = function(oneDivSize,element,rowIndex,colIndex){
element.style.width = oneDivSize+'%';
element.style.height = oneDivSize+'%';
element.style.borderWidth ="1px";
element.style.borderColor ="green";
element.style.borderStyle ="solid";
var boundingRect = element.getBoundingClientRect();
element.style.position ="absolute";
element.style.left =colIndex * boundingRect.width+"px";
element.style.top =rowIndex * boundingRect.height+"px";
};
boundingRect.height Returns 2 px
But the same code works properly in chrome.
Thanks in Advance
Regards,
Alex
I have fixed the issue by replacing getBoundingBox with window.innerHeight.
Regards Alex
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.