RnD
RnD

Reputation: 1069

Ajax loading a slider

I got a menu div and a content div

If I put the slider (it's a jquery plugin) in the index.php everything works fine, picture below

enter image description here

But what I want to do is to put every page's content on a different file, for example home page should contain this slider with some basic info, so I put it on home.php

Now as I want to load it I do this:

$("#nav_home").click(function(){
    $("#content").load('pages/home.php');
});

and here's the part where it crashes, from the slider above it becomes like this:

enter image description here

HTML:

<ul id = "nav"><!-- menu -->
    <li id="nav_home"><a href="#">Home</a></li>    
</ul> 

<div id='content'><!-- content div -->
</div>

Upvotes: 0

Views: 1509

Answers (1)

Linas
Linas

Reputation: 4408

Try something like this:

$("#nav_home").click(function(){
    $("#content").load('pages/home.php', 
        function(){
            $("#slider").easySlider({
                auto: true,
                continuous: true 
            });
        }
    );
});

Upvotes: 2

Related Questions