Leoh
Leoh

Reputation: 670

load a page containing Flexslider with ajax not working

I have a page that load diferent galeries of projects with ajax. that is working fine but when i want to see the project doing a clik doesnt load the page that is containing the descripcion and gallery of the project.

this is my main page:

    $("#residential").on('click', function (event) {
        $.ajax({
        url: 'residential.html'
        , dataType: 'html'
        }).done(function (data) {
        $('#projects').append(data);
    }); 
});

load in the div:

<div class="ten columns content" id="projects">
</div>

when i clicked the image of the project i want that load a page with ajax that contains the flexslider but doesnt work so in the other page that i I loaded previously.

$(document).ready(function() {
$("#galery_res").on('click', function (event) {
    $.ajax({
        url: 'galery_res.html'
      , dataType: 'html'
    }).done(function (data) {
        $('#projects').append(data); // the same div of the main page
    }); 
});
});

the page with flex slider:(load the images without the css)

<link rel="stylesheet" href="flexslider.css" type="text/css" media="screen" />
<body class="loading">



<div id="container">


<div id="main" role="main">
  <section class="slider">
    <div class="flexslider">
      <ul class="slides">
        <li>
            <img src="images/galeria1.jpg" />
            </li>
            <li>
            <img src="images/galeria1.jpg" />
            </li>
            <li>
            <img src="images/galeria1.jpg" />
            </li>
            <li>
            <img src="images/galeria1.jpg" />
            </li>
      </ul>
    </div>
  </section>

  </div>

  </div>

  <!-- jQuery -->

  <script type="text/javascript" src="jquery-1.7.2.min.js"></script>

 <!-- FlexSlider -->

 <script defer src="jquery.flexslider.js"></script>

 <script type="text/javascript">
 $(function(){
   $(window).load(function() {
   $('.flexslider').flexslider({
   animation: "slide"
   });
   });
 });
</script>

Upvotes: 0

Views: 2481

Answers (1)

M Khalid Junaid
M Khalid Junaid

Reputation: 64486

$(document).ready(function() {
   $("#galery_res").on('click', function (event) {
$.ajax({
    url: 'galery_res.html'
  , dataType: 'html'
}).done(function (data) {
    $('#projects').append(data); // the same div of the main page
    $('.flexslider').flexslider({
animation: "slide"
});
}); 
});
});

i think so it is $('#projects').append(data); not $('#proyects').append(data);

Upvotes: 1

Related Questions