#1
  1. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,672
    Rep Power
    171

    Jquery scroll nto working


    Hi;

    Can someone please tell me why it doesn't scroll on page load?

    Code:
    $(function()
    	{
    		alert('Js Workin');
    		$.scrollTo( '#form_location', 0, {offset:0} ); 
    	});
    Thank you
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2009
    Location
    Nebraska, USA
    Posts
    876
    Rep Power
    275
    probably because there isn't anything on that page with an ID of "form_location"
  4. #3
  5. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,672
    Rep Power
    171
    Originally Posted by DonR
    probably because there isn't anything on that page with an ID of "form_location"
    There is:
    Code:
    <form class="enquiry-form" id="form_location">
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2009
    Location
    Nebraska, USA
    Posts
    876
    Rep Power
    275
    try it like this
    Code:
    $('#form_location').scrollTo( {offset:0} );
  8. #5
  9. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,672
    Rep Power
    171
    Originally Posted by DonR
    try it like this
    Code:
    $('#form_location').scrollTo( {offset:0} );
    No differnece.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2009
    Location
    Nebraska, USA
    Posts
    876
    Rep Power
    275
    what if you go without the offset?
    $('#form_location').scrollTo();
  12. #7
  13. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,672
    Rep Power
    171
    Originally Posted by DonR
    what if you go without the offset?
    $('#form_location').scrollTo();
    Not working!
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    50
    Rep Power
    35
    It looks like your
    Code:
    <form class="enquiry-form" id="form_location">
    form is nested inside the
    Code:
    <form action="http://www.tophoteldeals.com.au/index.php/process_form/check/6/enq" method="post" accept-charset="utf-8">
    form and so is being removed from the DOM by the browser.
  16. #9
  17. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,672
    Rep Power
    171
    Originally Posted by Edge360
    It looks like your
    Code:
    <form class="enquiry-form" id="form_location">
    form is nested inside the
    Code:
    <form action="http://www.tophoteldeals.com.au/index.php/process_form/check/6/enq" method="post" accept-charset="utf-8">
    form and so is being removed from the DOM by the browser.
    Good stuff you got it
  18. #10
  19. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,672
    Rep Power
    171
    Hey;

    Scroll is not working again! Can you see what is wrong?

    I am like can't see whats wrong!

    When I submit the form it works!

    javascript Code:
    <script>
    	$( document ).ready(function() {
    		{
    			$('#form_location').scrollTo();
    		});
    </script>


    Thanks
  20. #11
  21. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2009
    Location
    Nebraska, USA
    Posts
    876
    Rep Power
    275
    looks like too many opening curly braces to me.
  22. #12
  23. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,672
    Rep Power
    171
    Originally Posted by DonR
    looks like too many opening curly braces to me.
    javascript Code:
    <script>
    	$( document ).ready(function() {
    			$('#form_location').scrollTo();
    		});
    </script>
    Made no difference

IMN logo majestic logo threadwatch logo seochat tools logo