Jump to content

Recommended Posts

I have a javascript code

window.scroll(0,1200);

 

which used to scroll the webpage vertically onload to the middle.But now it is not working!

 

is there any other code available(either in jquery or javascript) that help to scroll the page to the half of the page.

 

thanks

 

this is my javascript code.The code in yellow is for scrolling of images,both need to be called on page load

 

function pageScroll() {

    window.scrollBy(0,1000);

var c=0;

var s;

s=setTimeout("photoGallery();",12000 );

}

 

var c=0;

var s;

function photoGallery()

{

if (c%3==0){

document.getElementById('photo-gallery').src = "images/TIME1.gif";

}

if (c%3==1){

document.getElementById('photo-gallery').src = "images/TIME2.gif";

}

if (c%3==2){

document.getElementById('photo-gallery').src = "images/TIME3.gif";

}

c=c+1;

s=setTimeout("photoGallery();",12000 );

 

}

 

 

  </script>

</head>

<body onLoad="pageScroll();">

"c%3==0" ?

 

Is this some kind of formatting error from posting, or is that actually your code? Most likely that would trigger a syntax error (check the error console, in FF it's under "Tools" > Error Console"), which would prevent the rest of the code from working.

 

Edit: by the way the yellow wasn't a good choice. I had to highlight it to read it - use


tags in future.

nothing that sort ,i checked even by blocking that particular function and running only window.scrollBy(0,2000);

no scrolling takes place.

 

You say "only running window(...)" - did you bind it to the window.onload event? Could you show the code you were testing here?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.