Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Center & Rotate image with IE8 (jQueryRotate)

All,

I'm looking for a way to center and rotate an image in response to a button click. I'm using the jQueryRotate library.

Here is the approach I was considering.

http://jsfiddle.net/HatAndBeard/k3Gxj/6/

This works fine in Chrome/Firefox but not in IE8 or lower. There are some image artifacts that I can't get rid of. Any ideas?

P.S. I don't have strict requirements for how the rotation is done, so other approaches are welcome as well.

P.S.S I can post the code if JSFiddle links aren't to your liking.

like image 426
HatAndBeard Avatar asked Oct 20 '11 19:10

HatAndBeard


People also ask

What is your center meaning?

It is often referred to as a state of emotional and spiritual equilibrium. It allows you to be accepting of the good and the bad in life and understand that things are always changing, but you can return back to your center to help yourself feel more balanced and grounded when things are difficult.

Which centre means middle?

middle, center, midst indicate something from which two or more other things are (approximately or exactly) equally distant. middle denotes, literally or figuratively, the point or part equidistant from or intermediate between extremes or limits in space or in time: the middle of a road.

How do you spell centered in British English?

Centered and centred are both English terms. In the United States, there is a preference for "centered" over "centred" (99 to 1). In the United Kingdom, there is a 72 to 28 preference for "centred" over "centered".

What word means centre?

synonyms: center, core, essence, gist, heart, heart and soul, inwardness, kernel, marrow, meat, nitty-gritty, nub, pith, substance, sum.


2 Answers

I ended up working around the problem by using the BasicImage rotation functionality in IE. I only needed to show the images in 90 degree increments so this approach was workable.

A rough sketch of what I did...

function ieRotate(element, rotation) {
            var rotationInt = 0;
            switch (rotation % 360) {
                case 0:
                    rotationInt = 0;
                    break;
                case 270:
                case -90:
                    rotationInt = 3;
                    break;
                case 180:
                case -180:
                    rotationInt = 2;
                    break;
                case 90:
                case -270:
                    rotationInt = 1;
                    break;

            }
            element.css('filter', 'progid:DXImageTransform.Microsoft.BasicImage(rotation=' + rotationInt + ')');
        }
like image 68
HatAndBeard Avatar answered Sep 21 '22 10:09

HatAndBeard


Hi im a author of this plugin and I welcome any of comments and issues about this plugin on the homepage of a plugin :)

Can you explain a bit more your problem, as I cant get it to reproduce in IE 8 or IE7 emulated in IE8. Also creating issue would be nice :)

The only "strange" problem that I saw is just a loading image effect that you can easily get rid of if after loading your page you just do a $(img).rotate(0) -> this will make sure that when you click image it will be ready to animate :)

Cheers,

like image 31
Paweł Witkowski Photography Avatar answered Sep 21 '22 10:09

Paweł Witkowski Photography