Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Backbutton in CSS

    I have tried to build a website to display data on my iphone, and used a CSS template which I have amended.
    The site as can be seen here works OK, except that the backbutton takes me back to the home page each time, instead of working like a breadcrumb (taking me back just one level).

    This is my first website and any help would be appreciated to get this to work properly, as I have tried now for the past few days and failed miserably!

    I have attached 2 text files, the index & css files.
    Attached Files Attached Files
    Last edited by rossoreed; 11-04-2011 at 12:12 AM.

  • #2
    Mr.
    Mr. is offline
    Regular Coder
    Join Date
    Feb 2011
    Posts
    112
    Thanks
    8
    Thanked 4 Times in 4 Posts
    You have no backbutton on the page... what are you talking about? The only button I see added when you click through is the "Hub" button and that obviously will take you back to the home page.

    Please tell me what "back" button you're talking about.

  • #3
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Mr. View Post
    You have no backbutton on the page... what are you talking about? The only button I see added when you click through is the "Hub" button and that obviously will take you back to the home page.

    Please tell me what "back" button you're talking about.
    I want the 'Hub' button to become a backbutton, so instead of taking me back to the home page, it takes me to the last hierarchical page.
    So, for example;
    From the home page 'Hub', I select 'Instant Power Data', and then select 'Solar Power', I would like the 'Hub' button to then display 'Instant Power Data', and take me to the 'Instant Power Data' page if I select it.

    This is what I have been trying to achieve, (and failed so far!)

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You would need to use javascript to "go back" or keep track of the page the user is on and update the url for that button. This can be done with php, or javascript. Seeing as how you are using a template, you probably won't know how to do it in php so the simplest thing would be to change this
    Code:
    <a id="homeButton" class="button" href="#Hub">Hub</a>
    to this
    Code:
    <a id="homeButton" class="button" href="#Hub" onclick="window.history.go(-1);return false">Back</a>
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by _Aerospace_Eng_ View Post
    You would need to use javascript to "go back" or keep track of the page the user is on and update the url for that button. This can be done with php, or javascript. Seeing as how you are using a template, you probably won't know how to do it in php so the simplest thing would be to change this
    Code:
    <a id="homeButton" class="button" href="#Hub">Hub</a>
    to this
    Code:
    <a id="homeButton" class="button" href="#Hub" onclick="window.history.go(-1);return false">Back</a>
    Thanks, I have amended the code, but it does not seem to work, see http://powerhub.info/iphone/#_hub
    It seems to try and go back, but changes it's mind, and returns to the same page.

  • #6
    Mr.
    Mr. is offline
    Regular Coder
    Join Date
    Feb 2011
    Posts
    112
    Thanks
    8
    Thanked 4 Times in 4 Posts
    I don't believe you have to use javascript to fix this... please attach the javascript file as well though. thanks.

  • #7
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Mr. View Post
    I don't believe you have to use javascript to fix this... please attach the javascript file as well though. thanks.
    Attached is the iphonenav.js file saved as a text file.
    Attached Files Attached Files

  • #8
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sorted

    Thanks for the comments and suggestions, but I have located the template authors website http://www.iui-js.org/ which has an updated version - with backbuttons!
    My mobile site is now working at http://powerhub.info/mobile/#_Hub if you want to see it in action.


  •  

    Posting Permissions

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