I have a static image 500x640 sitting in a folder in which 20 pieces 20 pieces with css-sprites, I set the background position for each part to be displayed, I need this kind of display to be able to manipulate each part later.
CSS
.piece { width: 20px; height: 20px; display: inline-block; //display: inline; //zoom:1; } .ob { background-image: url("/Images/ob.jpg");}
JS:
<script id="flipTemplate" type="text/html"> <div class="piece ob" data-bind="style: { backgroundPosition: viewModel.getLeftValue($index) + ' ' + viewModel.getTopValue($index) }, attr: {cond: Cond, id: Id }, click: viewModel.setClick "> </div> </script> <script type="text/javascript"> viewModel = { flips: ko.observableArray([]), setClick: function (data, e) { e.preventDefault(); //doing click }, getLeftValue: function (index) { var position = 0; var currentLine = div(index(), 25); if (currentLine > 0) return '-' + (index() - (currentLine * 25)) * 20 + 'px'; else return '-' + index() * 20 + 'px'; }, getTopValue: function (index) { return '-' + (div(index(), 25)) * 20 + 'px'; } }; ko.applyBindings(viewModel); </script> function div(val, by){ return (val - val % by) / by; }
I have performance issues. For example, in Opera and FF, images load very fast for about 1 second, in IE for about 3 seconds, but in Chrome it loads very slowly 
It takes about 17 seconds to display all fragments in Chrome.
The browser only makes one request to get the image, and not cut small pieces, why can it take so long in Chrome?
Can performance be improved? 
just did CTRL + Update and here is the weird download result: 
UPDATE: I just posted a sample here: http://bit.ly/TrcCdp
UPDATE: In my example, there is a JSON array, it contains 800 elements, so Iโll just find out if it has decreased, for example, 600-700 elements, the performance improves, but I donโt care about 800 elements.
For example, when there are only 600 elements, this reduces the load in Chrome by about 6 seconds ....
Perhaps there might be a problem somewhere at the point where the note iteration of the template is performed?