0

Iam loading content in my pages dynamically with php. I want to add a nice affect like a fade-in with jquery.

But i want my page still working if the user has javascript turn off.

This is my php code to load the content:

/// load page content
        $pages_dir = 'content';

        if(!empty($_GET['p'])) {

            $pages = scandir($pages_dir, 0);
            //delete . and ..
            unset($pages[0], $pages[1]);

            $p = $_GET['p'];

            // only files that are in the array can be loaded
            if (in_array($p. '.php', $pages)) {
                include($pages_dir. '/'.$p. '.php');    

            } else {
                echo 'This page is not available';
            }
        } else {
            include($pages_dir. '/index.php');
        }
user1386906
  • 1,161
  • 6
  • 26
  • 53
  • Your PHP code isn't relevant here; can you show us your jQuery code instead? – Sampson Dec 03 '12 at 15:56
  • So, the fade-in happens on the client, which has ZERO to do with PHP. – Diodeus - James MacFarlane Dec 03 '12 at 15:56
  • 1
    Pages/sites which force me to sit through a pointless fade-in effect are sites I will never visit again. Gimme my data/info NOW, and don't waste my time with useless visuals. – Marc B Dec 03 '12 at 15:57
  • possible duplicate [http://stackoverflow.com/questions/6262047/jquery-body-fade-in](http://stackoverflow.com/questions/6262047/jquery-body-fade-in) – itachi Dec 03 '12 at 15:57
  • @MarcB While I agree, we're not really a [usability site](http://ux.stackexchange.com/) ;) We're just here to beat the daylights out of technical issues programmers face. – Sampson Dec 03 '12 at 15:58
  • @MarcB Even my aunt hates it.... just got the feedback. – itachi Dec 03 '12 at 15:59

1 Answers1

3

This is what i did. wrapped a div around my PHP code with id "fadein" and then used this jquery code:

$(function(){
            $('#fadein').hide();
            $('#fadein').fadeIn();

        });

Easy

user1386906
  • 1,161
  • 6
  • 26
  • 53