苹果CMS指南

将代码放置到模板目录 template/模板名称/html/index 下的 include.html 文件中,CSS用来控制播放器动画与定位,JS实现滚动监听逻辑。

<style type="text/css">
 .in {
 animation: ac 1s;
}
.out {
 position: fixed; 
 bottom: 50%;(播放器位置)
 right: 1%;(播放器位置)
 z-index: 999;
 animation: an 0.5s;
}
</style>
<script>window.jQuery || document.write('<script src="/macplus/js/jquery-1.11.0.min.js"></script>')</script>
<script type="text/javascript">
 window.onload=function(){
 var ha = ($('.MacPlayer').find('table').offset().top + $('.MacPlayer').find('table').height());
 $(window).scroll(function(){ 
 if ( $(window).scrollTop() > ha ) { 
 $('.MacPlayer').find('table').removeClass('in').addClass('out');
 $('.MacPlayer').find('table').css('height','200px');(播放器大小)
 $('.MacPlayer').find('table').css('width','350px');(播放器大小)
 } else if ( $(window).scrollTop() < ha) { 
 $('.MacPlayer').find('table').removeClass('out').addClass('in'); 
 $('.MacPlayer').find('table').css('height','100%');
 } 
 });
}
</script>

可以自行修改注释标记处的位置参数、宽高数值,调整悬浮播放器的显示位置与尺寸。页面向下滚动超过播放器原始位置时,播放器切换为悬浮状态,回到上方则恢复原有布局。