Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Locating a certain vertical spot in a DIV

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #30206
    kam
    Member

    Not really sure which category this goes in to so……

    I have a DIV set to 500px height and overflow set to auto. I then put a table in the DIV from MySQL and voila – I get a table that can scroll up & down all these records within confines I’ve set up. Cool.

    But now people want to modify the MySQL records. Setting up the form and running the MySQL CRUD is all OK. What is bothering people is that if they modified record #1000 and submitted the changes, the re-drawn web page will put them back to the top-most record. They then have to scroll all the way down to record #1000 to see the effects of their change.

    Is there anyway I can run a jQuery or JS script (hell, for that matter any code) that will (on load) bring that table to the #1000 record automagically within the DIV?

    I realize AJAX could do this easier but doing that is changing the whole site. I can’t do that right now.

    Thanks
    Kevin

    #80209
    Chris Coyier
    Keymaster

    Give the

    elements ID values, then you can have the page people are directed to after the update include the hash of that ID. Like:

    site.com/#1000

    The area should automatically scroll to ensure that element is visible.

    #79960
    kam
    Member

    Sorry, no Joy. Thought of that, but was pretty sure that it wouldn’t scroll the window within a window. Anyways tried it with a record id I know is in there and ‘schedule.php/#532’ to it and seemed to have lost my CSS file. Everything became B&W, lost my floats and background colors and the 2 tables-within-divs were both written all thru the page. But on a good note the topmost record was record #532 :-)

    I am presently looking at some JS code that determines the height of the scroll bar when starting to edit the record and then will set the div back to that height on loading. Don’t know how well that will work.

    Kevin

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.