i have this function that starts a slideshow automatically and i need to delay it till the server executes query and echo data
$(document).ready(function(){
$('#camera_wrap_2').camera({
height: '380px',
loader: 'bar',
pagination: false,
thumbnails: true
});
});
i've tried this but didn't work
$(document).ready(function(){
setTimeout(camera,2000);
});
$('#camera_wrap_2').camera({
height: '380px',
loader: 'bar',
pagination: false,
thumbnails: true
});
If with
server executes query
you mean some ajax call then you need to use the callback and call your code there.
Otherwise, in the timeout example, you need to create a function named camera
because that is what setTimeout
expects
$(document).ready(function(){
setTimeout(camera,2000);
});
function camera(){
$('#camera_wrap_2').camera({
height: '380px',
loader: 'bar',
pagination: false,
thumbnails: true
});
}