Advanced Search

Results 1 to 9 of 9

Thread: Content progression

  1. #1
    Join Date
    Jan 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow Content progression

    Hi everyone!,

    This is my first post on dynamic forums, i have browsed and used dynamic drive solidly for the last two years. It is a great resource. I am purley a designer, css and html literate and the usal design software.

    I am designing a site at the moment and trying to find some sort of javascript solution to an idea.

    The site has a menu at the top and three panels (divs) below. What we want to happen is have some one choose a menu option and load it in panel one, choose another menu option and load it in panel two, choose another menu option and load it in panel three, then back to panel one, so the user can continue to view there previous choices.

    Any ideas or suggestions would be much appreciated. Would it be easy to adapt a random content script to a cycling content script.

    If this is not the right forum for this let me know.

    Peace.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    An interesting idea. I quite like it.

    It's certainly possible. What, though, do you mean by "load?" Where is this data coming from? Is it an external page, or is it stored in a Javascript variable?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Jan 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow

    By loading i ment having the content in a div and getting it to appear in the desired colum. Could also be nice to do it with XML.

    Would someone be willing to help me out with this?

    Cheers

  4. #4
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    797
    Thanks
    86
    Thanked 2 Times in 2 Posts

    Default

    Why not place three <iframes> ?

  5. #5
    Join Date
    Jan 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow

    Quote Originally Posted by chechu View Post
    Why not place three <iframes> ?
    Would this allow me to cycle information across the three iFrames?

    I have been advised about avoiding iFrames from teachers and other designers.

  6. #6
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,486
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Could do it in Flash. Heh
    {CWoT - Riddle } {OSTU - Psycho} {Invasion - Team}
    Follow Me on Twitter: @Negative_Chaos
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  7. #7
    Join Date
    Jan 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow Well

    Quote Originally Posted by BLiZZaRD View Post
    Could do it in Flash. Heh
    It could be done in basic aswell . Nah flash has crossed my mind and i could do it that way myself, but its not friendly way to do it, flash player reliant but the same problem with java script disabled browsing. Ajax would be a dream. Looks beeter than flash. Anyway i may have to settle for something a little less ambitious.

  8. #8
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,156
    Thanks
    262
    Thanked 690 Times in 678 Posts

    Default

    Ajax, Flash and Javascript are all 'more' than iframes.
    It's best to avoid EVERYTHING that you don't need. The exceptions would be PHP (as it outputs pure html from the server, no programming, so it's always consistant, not user dependant and doesn't vary by browser/OS) and ASP JSP etc., and CSS (since it's very widely supported and generally helpful).

    But in short, don't use what you don't need. Ajax especially causes problems. I assure you, iframes will be more supported than ajax. Likely all browsers that support any javascript will support iframes. And iframes can't just be disabled, like javascript can be. (I don't think so anyway.)
    Flash and other similar things require plugins. I avoid them if at all possible. Your visitors won't see a thing without the plugin.

    So... what's the answer? Keep it simple. All you need here is an iframe and some basic javascript.

    Just target the links (all of 'em) to the 'main' or 'first' iframe. I'd suggest maybe the middle one in case the javascript doesn't work so it keeps it centered. I'd have some nice background on a blank page for the other two frames while they aren't used for holding content (unless you load some content to start).
    Now, for each link also include an onClick attribute, something like onClick="return loadme(this.href);" which will call a function and send as a value the location for the link, while returning it, NOT the original thing (meaning loading the page). If javascript DOES fail, it's a nice fallback as it'll still load normally.
    For the function, you should just use, basically:
    function loadme(url) {
    framecount++;
    if (framecount&#37;3 == 0) framenum = 2; //start frame
    else if (framecount%3 == 1) framenum = 3; //next frame
    else framenum = 1; //third frame
    window.framename.location = url;
    }

    Notes:
    1. I don't know if the last line is right. I don't do JS that much. But if you wrote that correctly, this would work, and well.
    2. framecount must be set as a global value, so it keeps track each time, not just for each occurance of the function.
    3. I believe the modulus operator exists in javascript. Should give the remainder. I hope. PHP does that, anyway.
    4. Braces left off the if/else if/else statements... just one line, so should be ok. If you needed to add more to them, then add braces (like "if (...) {...}").

    Additional thoughts: You could avoid the if/else if/if entirely and just set the framenumber to framecount, if you could deal with just having a number as that. 1, 2, 3 as the frames.
    You also could EASILY adapt this to any number of frames or layout. Very easy to do that.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  9. #9
    Join Date
    Jan 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    djr33, thanks mate!! Will have a go at getting this to work and post results here shortly. Cheers again!!

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
  •