Link to home
Start Free TrialLog in
Avatar of CREATiVENESS
CREATiVENESSFlag for United States of America

asked on

Sliding a large image across the screen

Hi Guys,
I am working on setting up a image that is over 7000 px wide and i want it to slide back and forth when you roll over the edges.
Please review here
http://creativeness.com/MLK_POC/MLK_proof_rfa.html

Right now I had set it up to jump to center to start and then using jquery localscroll I jump to certain divs by clicking on the bottom right buttons in the link. But right now I need it to scroll right and left by rolling over the buttons in the middle of the sides. Any ideas?
I want it to scroll smoothly on rollover until you reach the ends then go no where else.
All help is really appreciated.
Thanks,
Randy
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Avatar of CREATiVENESS

ASKER

Well I would like to concentrate it to the buttons though. Maybe using a code like this.

 	function goRight() { 
	    document.images['ball1'].style.left = parseInt(document.images['ball1'].style.left)+2 +"px"; 
	} 
	function goLeft() { 
	 	document.images['ball1'].style.left = (parseInt(document.images['ball1'].style.left)-2) +"px"; 
 	} 
	

Open in new window


Than using a setInterval or something to use on a rollover and rollout. Any Ideas? Thanks.
So you want it to pan when you click the buttons or mouse over them?
mouseover would be preferred.
Ok, but do you want the scroll to happen with the mouse over or with a click?
when you rollover the buttons it should move and when you rollout it should stop.
greetings : CREATiVENESS, , I wasn't going to post here, but no one has offered any suggestions to "Move" your image. I do image animation all the time, and to me it is not difficult. You start by setting the image to an absolute position, If it is in a "Container" you MUST set the container to relative position, for this to work. Next set three variables, one to keep track of the changing position as posY , one to have the DOM of the image, and one to change the "Stop position" as imgStop .  In the function you add or subtract to the posY the number of pixels to move per frame, change the top or left or both of the style of the DOM image object domR ,  Be sure to stop the animation by testing for  "less than" or " greater than" the  imgStop value.  Some code below. If you have not done this sort of thing before, do NOT try first on your production page, try some animations on a "Test" page, with simple movements, to get a working knowledge of this method, then apply it to your large image. You can get the movement started with a onmouseover="moveit( )" for an image or container, you'll need to add a "stopIt" variable if you want to stop the animation with a onmouseout="stopIt( )"

<script>
var posY=-208;
var imgStop = -1;
var domR = document.getElementById("rocket1");

function soar2( ){
    posY+=4;
    domR.style.top=posY+'px';
    if (posY < imgStop) setTimeout("soar2( )",30);
    }
</script>
<img id="rocket1" src="rockt.jpg" width="240" height="75" style="position:absolute;top:-208px;right:16pxz-index:2;"/>

Open in new window


ask questions if you need more info
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Any reason for the B rating ...?