给网站侧边添加小姐姐随机跳舞可折叠组件

效果展示

给网站侧边添加小姐姐随机跳舞可折叠组件,我用的系统是WordPress,别的程序也支持使用!

初始效果

图片[1]-给网站侧边添加小姐姐随机跳舞可折叠组件-大海博客

使用效果

图片[2]-给网站侧边添加小姐姐随机跳舞可折叠组件-大海博客

教程

以WordPress为例子,我们进入网站后台找到【外观】-【小工具】-【自定义HTML】,添加以下代码,如果不是WordPress,自己在想要的位置找到对应文件添加。

图片[3]-给网站侧边添加小姐姐随机跳舞可折叠组件-大海博客

代码

<section id="xiaojiejie">
<div class="xiaojiejie"><style>#player { margin: 1px auto; max-width: 100%; border-radius: 10px; display: block; } #xjjsp { display: none; } #ckxjj,#gbxjj { width: 100%; height: 40px; border: none; background-color: #f95491; color: #fff; margin-top: 1px; border-radius: 5px; font-size: 18px; cursor: pointer; transition: 0.2s; } #ckxjj:hover,#gbxjj:hover { background-color: #eeb4bf; } .kzsp { width: 100%; display: flex; justify-content: space-between; } .kzsp>button { border: none; height: 40px; padding: 0 30px; font-size: 16px; background-color: #f95491; border-radius: 10px; color: #fff; transition: 0.3s; cursor: pointer; } .kzsp>button:active { background-color: #e25a00; }</style>
<button type="button" id="ckxjj">点我看小姐姐视频</button>
<div id="xjjsp">
<video id="player" src="https://www.cunshao.com/666666/api/web.php" controls="" alt="小姐姐视频"></video>
<div class="kzsp">
<button id="switch">连续: 开</button>
<button id="next">下一个</button>
</div>
<button type="button" id="gbxjj">关闭视频</button>
</div>
<script>
var player = document.getElementById('player');
var bind = function (element, event, callback) {
return element.addEventListener(event, callback);
};
var sp = 0;
$(document).ready(function () {
$('#ckxjj').click(() => {
$('#ckxjj').hide();
$('#xjjsp').show();
if (sp == 0) {
randomm();
sp = null
}
player.onerror = () => {
randomm()
}
player.play();
});
$('#gbxjj').click(() => {
$('#ckxjj').show();
$('#xjjsp').hide();
player.pause();
})
});
var get = function (id) {
return document.getElementById(id);
};
var auto = true;
// 生成播放视频
function randomm() {
player.src = 'http://v.nrzj.vip/video.php';
player.play();
};
bind(get('next'), 'click', randomm);
bind(get('switch'), 'click', function () {
auto = !auto;
this.innerText = '连续:' + (auto ? '开' : '关');
});
bind(player, 'ended', function () {
if (auto) randomm();
});
player.pause();
</script>
</div>
</section>
<section id="xiaojiejie">
    <div class="xiaojiejie"><style>#player { margin: 1px auto; max-width: 100%; border-radius: 10px; display: block; } #xjjsp { display: none; } #ckxjj,#gbxjj { width: 100%; height: 40px; border: none; background-color: #f95491; color: #fff; margin-top: 1px; border-radius: 5px; font-size: 18px; cursor: pointer; transition: 0.2s; } #ckxjj:hover,#gbxjj:hover { background-color: #eeb4bf; } .kzsp { width: 100%; display: flex; justify-content: space-between; } .kzsp>button { border: none; height: 40px; padding: 0 30px; font-size: 16px; background-color: #f95491; border-radius: 10px; color: #fff; transition: 0.3s; cursor: pointer; } .kzsp>button:active { background-color: #e25a00; }</style>
        <button type="button" id="ckxjj">点我看小姐姐视频</button>
        <div id="xjjsp">
            <video id="player" src="https://www.cunshao.com/666666/api/web.php" controls="" alt="小姐姐视频"></video>
            <div class="kzsp">
                <button id="switch">连续: 开</button>
                <button id="next">下一个</button>
            </div>
            <button type="button" id="gbxjj">关闭视频</button>
        </div>
        <script>
            var player = document.getElementById('player');
            var bind = function (element, event, callback) {
                return element.addEventListener(event, callback);
            };
            var sp = 0;
            $(document).ready(function () {
                $('#ckxjj').click(() => {
                    $('#ckxjj').hide();
                    $('#xjjsp').show();
                    if (sp == 0) {
                        randomm();
                        sp = null
                    }
                    player.onerror = () => {
                        randomm()
                    }
                    player.play();
                });
                $('#gbxjj').click(() => {
                    $('#ckxjj').show();
                    $('#xjjsp').hide();
                    player.pause();
                })
            });



            var get = function (id) {
                return document.getElementById(id);
            };

            var auto = true;
            // 生成播放视频
            function randomm() {
                player.src = 'http://v.nrzj.vip/video.php';
                player.play();
            };
            bind(get('next'), 'click', randomm);

            bind(get('switch'), 'click', function () {
                auto = !auto;
                this.innerText = '连续:' + (auto ? '开' : '关');
            });
            bind(player, 'ended', function () {
                if (auto) randomm();
            });
            player.pause();
        </script>
    </div>
</section>
<section id="xiaojiejie"> <div class="xiaojiejie"><style>#player { margin: 1px auto; max-width: 100%; border-radius: 10px; display: block; } #xjjsp { display: none; } #ckxjj,#gbxjj { width: 100%; height: 40px; border: none; background-color: #f95491; color: #fff; margin-top: 1px; border-radius: 5px; font-size: 18px; cursor: pointer; transition: 0.2s; } #ckxjj:hover,#gbxjj:hover { background-color: #eeb4bf; } .kzsp { width: 100%; display: flex; justify-content: space-between; } .kzsp>button { border: none; height: 40px; padding: 0 30px; font-size: 16px; background-color: #f95491; border-radius: 10px; color: #fff; transition: 0.3s; cursor: pointer; } .kzsp>button:active { background-color: #e25a00; }</style> <button type="button" id="ckxjj">点我看小姐姐视频</button> <div id="xjjsp"> <video id="player" src="https://www.cunshao.com/666666/api/web.php" controls="" alt="小姐姐视频"></video> <div class="kzsp"> <button id="switch">连续: 开</button> <button id="next">下一个</button> </div> <button type="button" id="gbxjj">关闭视频</button> </div> <script> var player = document.getElementById('player'); var bind = function (element, event, callback) { return element.addEventListener(event, callback); }; var sp = 0; $(document).ready(function () { $('#ckxjj').click(() => { $('#ckxjj').hide(); $('#xjjsp').show(); if (sp == 0) { randomm(); sp = null } player.onerror = () => { randomm() } player.play(); }); $('#gbxjj').click(() => { $('#ckxjj').show(); $('#xjjsp').hide(); player.pause(); }) }); var get = function (id) { return document.getElementById(id); }; var auto = true; // 生成播放视频 function randomm() { player.src = 'http://v.nrzj.vip/video.php'; player.play(); }; bind(get('next'), 'click', randomm); bind(get('switch'), 'click', function () { auto = !auto; this.innerText = '连续:' + (auto ? '开' : '关'); }); bind(player, 'ended', function () { if (auto) randomm(); }); player.pause(); </script> </div> </section>

© 版权声明
THE END
喜欢就支持一下吧
点赞15赞赏 分享
Forever facing sunlight, so you can not see the shadow of the.
永远面向阳光,这样你就看不见阴影了
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片快捷回复

    暂无评论内容