SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jun 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Direct links to expanding/contracting sections

    Hi Paul,
    first of all thank you for all of your assistance, You've never answered my question particularly but I keep stumbling upon your posts when I have problems and you've been extremely helpful. Secondly, I really hope you can still get back to this thread and assist me further with a similar problem I have because I really haven't been able to find a solution elsewhere and your suggestions here are the best I've come across.

    Now, I understand that javascript is not the best tool for this but what i need to do is exactly what you've explained and demo-ed, except I can't use a form with options, I have actual links, separated and spread all over the page, and I need to keep them that way.

    That being said I'm having troubles figuring out how to edit your last function [ed: in link to toggle div on opening new page] so it pulls the value or even the child node of the <a> element that is going to trigger a change on an already loaded page. Since the <a> element also requires an href attribute it will inevitably affect the url after clicking on that link and result in something like sample.com/sample.html#section rather than sample.com/sample.html$id=1. Any suggestions how to go around that?

    Also can you please explain a bit more this
    Code:
    if (qs.lang) {
        select.value = qs.lang;
    }
    Is lang a keyword because I wasn't able to find such a keyword and yet changing it to something arbitrary(in the js file and in the url with the new querystring) didn't work? Also I pulled the files you'd edited as an example and in an attempt to understand what qs actually holds I simply placed an alert after the above code and all it returned was [object Object].

    Is what I'm doing completely wrong or is this the output it is supposed to give at this point of the script? Isn't object supposed to be "lang" and Object to "English"?

    Also in your example changing the language in the box doesn't change the uri in the browser, preventing the user from being able to share the newly updated page - they would have to manually change the request...Is there any way around that?

    I understand object-oriented programming and given the fact how image heavy, and complicated with interactivity this website is, I wish I had time to write it in a more appropriate language. For now though I pretty much have 2 weeks to figure out how to create direct links to every expanding/contracting section that is currently built with Javascript, Jquery and CSS and make sure they are all able to be indexed and visited directly from the search results page.
    Any suggestion is more than welcome and you're timely response is extremely valued!
    Last edited by paul_wilkins; Jun 12, 2012 at 16:46.

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,717
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Reno Dimitrova View Post
    so it pulls the value or even the child node of the <a> element that is going to trigger a change on an already loaded page. Since the <a> element also requires an href attribute it will inevitably affect the url after clicking on that link and result in something like sample.com/sample.html#section rather than sample.com/sample.html$id=1. Any suggestions how to go around that?
    Show us what you currently have, and we'll see if there's something that can be done to help.

    Quote Originally Posted by Reno Dimitrova View Post
    Also can you please explain a bit more this
    Code:
    if (qs.lang) {
        select.value = qs.lang;
    }
    Is lang a keyword because I wasn't able to find such a keyword and yet changing it to something arbitrary(in the js file and in the url with the new querystring) didn't work? Also I pulled the files you'd edited as an example and in an attempt to understand what qs actually holds I simply placed an alert after the above code and all it returned was [object Object].

    Is what I'm doing completely wrong or is this the output it is supposed to give at this point of the script? Isn't object supposed to be "lang" and Object to "English"?
    If the querystring was ?lang=English then the qs object would be the following object:
    {lang: 'English'}

    [object Object] is the default string that JavaScript shows for all objects. Dome developer tools can help to expose more of the internals of such objects.

    Quote Originally Posted by Reno Dimitrova View Post
    Also in your example changing the language in the box doesn't change the uri in the browser, preventing the user from being able to share the newly updated page - they would have to manually change the request...Is there any way around that?
    There is indeed - the easiest way being to navigate to a new page with the updated language as a part of the filename or the querystring.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Member
    Join Date
    Jun 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    Show us what you currently have, and we'll see if there's something that can be done to help.
    here's what I'm working on. Apologies for the ugly code and the insane amount of content in the hidden divs( it will be migrated to an XML file in the very near future) also it will be viewed in IE only and it's not tested in other browsers.

    https://bitly.com/NA0YhE

    So how can I create a link that leads directly to let's say step 4 of ip download instructions?


Bookmarks

Posting Permissions

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