Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6894797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:49:39+00:00 2026-05-27T06:49:39+00:00

After finding the latest version of Crafty’s game API seems to fail in IE8,

  • 0

After finding the latest version of Crafty’s game API seems to fail in IE8, I thought I would get back to my friend JQuery, to create a few simple board games.

I started off with 3 DIV’s, a black tile, a white tile, and blank tile, set Display:none

Then I thought to clone the blank tile to the dimensions of whatever board game I desired.
Using a simple double for loop, when set to 8×8 it crashes the browser, when set to 2×2 it is slow, can someone suggest me ways to improve the performance?

The CSS:

<style>
    .white {
        position:relative;
        width:57px;
        height:57px;
    }
    .white img {
        position:absolute;
        width:171px;
        height:57px;
        left:-57px;
        top:0px;
        clip:rect(0px, 114px, 57px, 57px); 
     }
    .blank {
        position:relative;
        width:57px;
        height:57px;
     }
    .blank img {
        position:absolute;
        width:171px;
        height:57px;
        left:-114px;
        top:0px;
        clip:rect(0px, 171px, 57px, 114px); 
     }
    .black {
        position:relative;
        width:57px;
        height:57px;
     }
    .black img {
        position:absolute;
        width:171px;
        height:57px;
        left:0px;
        top:0px;
        clip:rect(0px, 57px, 57px, 0px); 
     }

The HTML:

<div class="white" style="display:none">
   <img src="images/sprites.png" alt="">
</div>

<div class="black" style="display:none">
   <img src="images/sprites.png" alt="">
</div>

<div class="blank" style="display:none">
   <img src="images/sprites.png" alt="">
</div>

<div class="start">
</div>

The jquery:

$(document).ready(function()  {     
    B_W = 456;
    B_H = 456;
    B_X = 8;
    B_Y = 8;
    SQ_W = 57;
    SQ_H = 57;

    var i=0;
    var j=0;

    for(i = 0; i < B_X; i++) {
        for(j = 0; j < B_Y; j++) {
                $('.blank').clone()
                    .insertAfter('.start')
                    .css({
                        'position':'absolute', 
                        'top' : j * SQ_H + 'px', 
                        'left' : i * SQ_W + 'px', 
                        'display' : 'block'
                    });
        }
    }
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:49:39+00:00Added an answer on May 27, 2026 at 6:49 am

    The second best thing you can do is add the position and display attributes as a css style, and add the image as a background to the DIV, for example:

    <style>
    .blank
    {
       position:absolute;
       display:block;
       width:8px;
       height:8px;
       background: url('images/sprites.png')
    }
    </style>
    

    and then “play” with the background positioning. You can do this like so for the next 8×8 pixel portion of your sprites png:

    style="background-position: 8px 0px; "
    

    Also, have a template DIV at the start, which has an ID=blank instead of class=blank, and set the selector to:

    $('#blank')
    

    Best solution would be to use the canvas element though!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given the following HTML code snippet; after finding the link by ID, how would
I'm using Silverlight Beta 4 for a LOB application. After finding out today that
I'd basically like to use reflection in Powershell, and after dynamically finding the methods
I'm finding this kind of overriding after a new in java code very often
I am having trouble finding out why my iAd is not being removed after
After some time researching and trying different things I still cannot get my @ExceptionHandler
After finding out the hard way that clone() does not work as intended for
after finding out that there is a bug in the UITapGestureRecognizer ( How to
After finding the difflib.SequenceMatcher class in Python's standard library to be unsuitable for my
After finding the difflib.SequenceMatcher class in Python's standard library to be unsuitable for my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.