Ajax loading of recent videos added

This commit is contained in:
Saqib Razzaq 2016-03-16 19:32:19 +05:00
parent e1261fb372
commit de77cce240

View file

@ -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: {
"load_type":loadType,
"load_mode":loadMode,
"load_limit":loadLimit,
"load_hit":loadHit
},
beforeSend: function() {
// setting a timeout
$(main_object).text("Loading..");
},
// $(".popular-vids").css("max-height","auto"); success: function(data) {
// } $('#home_load_more').remove();
// } //$(main_object).attr('loadhit',load_hit);
// function removeSideactive(){ $(main_object).text("Load More");
// WinWidHome = $(window).width(); if (loadType == 'video') {
// if(WinWidHome > 1024){ $('#recent_vids_sec').append(data);
// $("body").addClass('sideactive'); }
// }
// else{
// $("body").removeClass('sideactive');
// }
// }
// $(document).ready(function(){ $('#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>');
// popVidHeight(); }
// removeSideactive(); });
// }); });
// $(window).resize(function() {
// popVidHeight();
// });
</script> </script>