Question

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');
        }
Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top