www.webdeveloper.com
Results 1 to 2 of 2

Thread: Redirect and scroll function

Hybrid View

  1. #1
    Join Date
    Mar 2013
    Posts
    1

    Redirect and scroll function

    I am trying to write a script for a button that onclick it will redirect to the designated address than scroll to the position. but i'm having some trouble with getting it to scroll after it goes to the designated url. can someone help?

    heres what I have:
    Code:
    function linkMenu(){
    	
    	window.location.href = "../AllMenu2.php";
    	if(true){scrollBreakfast();}
    	}
    	
    function scrollBreakfast()
    {	
    	window.scrollTo(0,315)
    	alert('scroll executed')
    	
    }

  2. #2
    Join Date
    Oct 2010
    Location
    Versailles, France
    Posts
    1,264
    It's not possible to scroll in the new page with this script !

    You could pass the position with the URI like with a GET
    Code:
    window.location.href = "../AllMenu2.php?scr=315";
    To insert it in a script in the new page with a onload function...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles