Ajax loading of recent videos added
This commit is contained in:
parent
e1261fb372
commit
de77cce240
1 changed files with 42 additions and 38 deletions
|
@ -57,7 +57,7 @@
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{$videos=get_videos(["order" =>"date_added DESC", "limit" =>6])}
|
{$videos=get_videos(["order" =>"date_added DESC", "limit" =>6])}
|
||||||
<section class="clearfix videos">
|
<section id="recent_vids_sec" class="clearfix videos">
|
||||||
<h1>{lang code="Recent Videos"}</h1>
|
<h1>{lang code="Recent Videos"}</h1>
|
||||||
<div class="clearfix row">
|
<div class="clearfix row">
|
||||||
{foreach $videos as $video}
|
{foreach $videos as $video}
|
||||||
|
@ -65,6 +65,7 @@
|
||||||
{include file="$style_dir/blocks/videos/video.html" display_type='homeVideos'}
|
{include file="$style_dir/blocks/videos/video.html" display_type='homeVideos'}
|
||||||
</div>
|
</div>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
<button id="home_load_more" class="btn btn-primary col-md-12 col-sm-12" loadtype="video" loadmode="recent" loadlimit="8" loadhit="1">Load More</button>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
@ -147,42 +148,45 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
// var WinWidHome = 0;
|
$('#home_load_more').on("click",function(){
|
||||||
// function popVidHeight(){
|
var loadLink = baseurl + '/ajax/home.php',
|
||||||
// WinWidHome = $(window).width();
|
main_object = $(this),
|
||||||
// if(WinWidHome > 991)
|
sendType = 'post',
|
||||||
// {
|
dataType = 'html',
|
||||||
// console.log("height "+WinWidHome);
|
loadType = $(main_object).attr('loadtype'),
|
||||||
// var bannerHeight = $("#banner").height();
|
loadMode = $(main_object).attr('loadmode'),
|
||||||
// console.log("height "+bannerHeight);
|
loadLimit = $(main_object).attr('loadlimit'),
|
||||||
// $(".popular-vids").css({
|
loadHit = $(main_object).attr('loadhit'),
|
||||||
// "max-height" : bannerHeight+"px",
|
newloadHit = parseInt(loadHit) + 1
|
||||||
// "overflow-y" : "auto"
|
;
|
||||||
// });
|
alert(loadHit);
|
||||||
// }
|
alert(newloadHit);
|
||||||
// else
|
$.ajax({
|
||||||
// {
|
url: loadLink,
|
||||||
// console.log("height "+WinWidHome);
|
type: sendType,
|
||||||
|
dataType: dataType,
|
||||||
|
data: {
|
||||||
// $(".popular-vids").css("max-height","auto");
|
"load_type":loadType,
|
||||||
// }
|
"load_mode":loadMode,
|
||||||
// }
|
"load_limit":loadLimit,
|
||||||
// function removeSideactive(){
|
"load_hit":loadHit
|
||||||
// WinWidHome = $(window).width();
|
},
|
||||||
// if(WinWidHome > 1024){
|
|
||||||
// $("body").addClass('sideactive');
|
|
||||||
// }
|
|
||||||
// else{
|
|
||||||
// $("body").removeClass('sideactive');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// $(document).ready(function(){
|
beforeSend: function() {
|
||||||
// popVidHeight();
|
// setting a timeout
|
||||||
// removeSideactive();
|
$(main_object).text("Loading..");
|
||||||
// });
|
},
|
||||||
// $(window).resize(function() {
|
|
||||||
// popVidHeight();
|
success: function(data) {
|
||||||
// });
|
$('#home_load_more').remove();
|
||||||
|
//$(main_object).attr('loadhit',load_hit);
|
||||||
|
$(main_object).text("Load More");
|
||||||
|
if (loadType == 'video') {
|
||||||
|
$('#recent_vids_sec').append(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#recent_vids_sec').append('<button id="home_load_more" class="btn btn-primary col-md-12 col-sm-12" loadtype="video" loadmode="recent" loadlimit="8" loadhit="'+newloadHit+'">Load More</button>');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
Loading…
Add table
Reference in a new issue