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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Apr 2011
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    TRUE Random Image Script Assistance Needed...

    hi there,

    i haven't posted much before and am INCREDIBLY new to coding. i am going to try my best to be clear and concise (to get the best help of course).

    i am building a website where i would like the main page to randomly choose of ALL images i have in a database and create a nice stream. on reload or revisit, i would like this stream to again be random. i would like each image in the stream to act as a link to the page/series it is apart of and i would of course like some sort of control as far as page formatting and size. (for different resolutions)

    that being said, i am basing this all on the follow site that i found. i am NOT copying the site, but the images reload is seamless and beautiful: The Site

    i have viewed his source and i have viewed his .js and his .css and i cannot find a single thing that shows me how he did it. i feel like i am going crazy.

    Resource Links:

    The Stylesheet

    The Javascript S/he uses.

    thank you for any and all help regarding this.



    riven.

  • #2
    New Coder
    Join Date
    Feb 2012
    Posts
    11
    Thanks
    0
    Thanked 4 Times in 4 Posts
    The randomizing with a db is more than html and css, you'll need php and mysql. As far as what Anton's site is doing, it looks like pages with a simple scroller that overflows off the page and utilizes a light box when you click an image, nothing spectacular. If you're incredibly new to coding, I wouldn't recommend tackling a project like this, start off with something smaller or by getting the different components of the site working separately, then eventually start combining them. Get a scroller to work like Anton's, then implement a light box, then add in the randomization with javascript, or php and database script. Baby steps.

  • #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,460
    Thanks
    0
    Thanked 632 Times in 622 Posts
    Trying to export the data from a database in random order is very inefficient. The best place to change the order to random would be in the PHP. Simply load all the references to the images into an array and then Shuffle the array so as to get them in random order. Then attach them into the page in their arreay order. You may also need to pass that array to JavaScript so that it can do the appropriate swaps after the page has loaded.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

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