开发者

Function delaying of chosen part of the site (php, js, ajax)

开发者 https://www.devze.com 2023-02-25 03:12 出处:网络
Does exists function which delayed the load the selected section of the page? In page I have two div\'s:

Does exists function which delayed the load the selected section of the page?

In page I have two div's:

<div id="slider">
   <!-- large amount of code -->
</div>

<div id="thumbs">
 开发者_如何学运维  <!-- small amount of code -->
</div>

Is it possible to placing the first div in some php functions to load up after reading this second?

Or is there a some delay function? Meaby put the div#slider in a separate file? (sliders is hidden click on the pictures starts it).

<?php include('slider.php'); ?>

<div id="thumbs">
   <!-- small amount of code -->
</div>

For example:

Lets say I have gallery: Gallery image

When I clicked on image, slider are extends (with slides for this thumb): slider

I want that the gallery of pictures to load as first (div #thumbs) and later part with sliders (in background).


if i understand the question correctly, you would have to use js (ajax) for that.

I use jquery library for handling that.

You can do something like this:

Have this load first on the page:

<div id="thumbs">
   <!-- small amount of code -->
</div>

and then in jQuery:

$(function(){
     setTimeout(function(){
          var slider = $('<div>',{id: 'slider'}).load('slider.php');
          $('#thumbs').before(slider);
     }, 5000); //load after 5 seconds
})
0

精彩评论

暂无评论...
验证码 换一张
取 消