0
I have a div that contains 12 jobs and a button below (see more) that loads 12 more jobs, the problem is that if I try $('#wrapperTrabalhos').append(data).hide().fadeIn();
entire div (#wrapperTrabalhos
) makes fadein, ie makes the hide()
and then fadeIn()
and I just wanted the 12 new jobs loaded to have that effect.
Jquery:
var worksLoaded = $('#wrapperTrabalhos a').length;
var projectsToLoad = 12;
$.ajax({
type: 'GET',
url: 'Ajax/AjaxSearch.php',
data:{'from':worksLoaded, 'projectsToAdd': projectsToLoad},
beforeSend: function() {
//alert();
},
success: function(data) {
$('#wrapperTrabalhos').append(data).hide().fadeIn(2000);
var projectsLoaded = $('#wrapperTrabalhos a').length;
var totalProjects = parseInt($('#wrapperTrabalhos a:last-child').attr('data-totalProjects'));
if (projectsLoaded === totalProjects) {
$('#viewMoreBtn').remove();
}
}
});
Ajaxsearch.php:
if (isset($_GET['from'], $_GET['projectsToAdd'])) {
$from = $_GET['from'];
$projectsToAdd = $_GET['projectsToAdd'];
$projects = $dataBase->fetchProjectsPagination($from, $projectsToAdd);
$countWork = $from+1;
$totalProjects = count($dataBase->fetchAllProjectsByDisplayOrder());
foreach ($projects as $workSeveralImg) {
echo '<a href="project.php?name=' .$workSeveralImg->short_name. '" data-count="' .$countWork. '" data-project_id="' .$workSeveralImg->id. '" data-totalProjects="' .$totalProjects. '" id="' .$workSeveralImg->short_name. '" title="' .$workSeveralImg->description. '"><img alt="' .$workSeveralImg->description. '" src="admin/' .$workSeveralImg->image_path. '"><div class="detailsHover"><span>\'' .$workSeveralImg->description. '\'</span><p>' .$workSeveralImg->type. '<br>' .$workSeveralImg->brand. '</p></div><div class="detailsHoverMob"><span>\'' .$workSeveralImg->description. '\'</span><p>' .$workSeveralImg->type. '<br>' .$workSeveralImg->brand. '</p></div></a>';
$countWork++;
}
}
What’s on that date? HTML? text?
– Sergio
I will update the question to get a better understanding
– Miguel
contains 12 more thumbnails, each with a more text image (job description etc...)
– Miguel