如何定位 jPlayer

发布于 2024-12-22 09:59:56 字数 396 浏览 0 评论 0原文

我似乎不知道如何定位 jPlayer。

我查看了 jPlayer 的文档,其中说 jPlayer 默认设置为绝对定位,但似乎并非如此,因为它似乎是页面流程的一部分,而不是像绝对定位元素那样脱离流程。

另外,我尝试将 left、top、bottom 和 right CSS 属性应用到 jPlayer 组成的一堆元素,但没有一次尝试进行任何更改。

另外,将选项添加到 jPlayer 上的 javascript 部分似乎也没有执行任何操作。我正在谈论此处列出的选项: http://www.jplayer.org/ 0.2.2/开发人员指南/。我尝试了顶部和左侧,但他们什么也没做。

I can't seem to figure out how to position jPlayer.

I looked at jPlayer's documentation which says that jPlayer is set to be absolute positioned by default, but it doesn't appear to be because it seems to be part of the flow of the page, not out of the flow like an absolutely positioned element is.

Also, I tried applying the left, top, bottom, and right CSS properties to a bunch of elements that the jPlayer is made of and not a single attempt made any change.

Also, adding options into the javascript section on jPlayer don't seem to do anything either. I'm talking about the options listed here: http://www.jplayer.org/0.2.2/developer-guide/. I tried top and left and they did nothing.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

冷︶言冷语的世界 2024-12-29 09:59:56

将其放在主 div 或第一个 div 标记中。然后,完成后,您可以根据需要编辑位置:

style="position: absolute;left: 100px;top: 40px;"

Put this in the main div or first div tag. Then, once you are done with it, you can edit the position as you wish:

style="position: absolute;left: 100px;top: 40px;"
羅雙樹 2024-12-29 09:59:56

您可以完全控制 jPlayer 实例的 HTML 标记和 CSS 外观/感觉。下面的示例(请参阅此处的 Fiddle

使用此标准 GUI 标记(取自 jPlayer 演示),

<div id="player"></div>
<div id="jp_container_1" class="jp-audio">
    <div class="jp-type-single">
        <div class="jp-gui jp-interface">
            <ul class="jp-controls">
                <li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
                <li><a href="javascript:;" class="jp-pause" tabindex="1" style="display: none; ">pause</a></li>
                <li><a href="javascript:;" class="jp-stop" tabindex="1">stop</a></li>
                <li><a href="javascript:;" class="jp-mute" tabindex="1" title="mute">mute</a></li>
                <li><a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute" style="display: none; ">unmute</a></li>
                <li><a href="javascript:;" class="jp-volume-max" tabindex="1" title="max volume">max volume</a></li>
            </ul>
            <div class="jp-progress">
                <div class="jp-seek-bar">
                    <div class="jp-play-bar"></div>

                </div>
            </div>
            <div class="jp-volume-bar">
                <div class="jp-volume-bar-value"></div>
            </div>
            <div class="jp-current-time"></div>
            <div class="jp-duration"></div>
            <ul class="jp-toggles">
                <li><a href="javascript:;" class="jp-repeat" tabindex="1" title="repeat">repeat</a></li>
                <li><a href="javascript:;" class="jp-repeat-off" tabindex="1" title="repeat off" style="display: none; ">repeat off</a></li>
            </ul>
        </div>
        <div class="jp-title">
            <ul>
                <li></li>
            </ul>
        </div>
        <div class="jp-no-solution" style="display: none; ">
            <span>Update Required</span>
            To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
        </div>
    </div>
</div>

您可以实例化使用此 javascript 的播放器

$(function() {
    $("#player").jPlayer({
        swfPath: "http://www.jplayer.org/latest/js/Jplayer.swf",
        supplied: "mp3",
        ready: function() {
            $(this).jPlayer("setMedia", {
                mp3:"http://static1.grsites.com/archive/sounds/animals/animals001.mp3"
            });
        }
    });         
});

可以在浏览器中呈现简单的、无样式的 HTML。您可以根据需要设计 jPlayer GUI 的样式。例如,通过添加一些定位规则

.jp-play, .jp-pause {
    position:absolute;
    left: 7em;
    top: 3em
}

You have full control of the HTML Markup and CSS look/feel of your jPlayer instance. Example below (see Fiddle here)

With this standard GUI markup (taken from the jPlayer demos)

<div id="player"></div>
<div id="jp_container_1" class="jp-audio">
    <div class="jp-type-single">
        <div class="jp-gui jp-interface">
            <ul class="jp-controls">
                <li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
                <li><a href="javascript:;" class="jp-pause" tabindex="1" style="display: none; ">pause</a></li>
                <li><a href="javascript:;" class="jp-stop" tabindex="1">stop</a></li>
                <li><a href="javascript:;" class="jp-mute" tabindex="1" title="mute">mute</a></li>
                <li><a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute" style="display: none; ">unmute</a></li>
                <li><a href="javascript:;" class="jp-volume-max" tabindex="1" title="max volume">max volume</a></li>
            </ul>
            <div class="jp-progress">
                <div class="jp-seek-bar">
                    <div class="jp-play-bar"></div>

                </div>
            </div>
            <div class="jp-volume-bar">
                <div class="jp-volume-bar-value"></div>
            </div>
            <div class="jp-current-time"></div>
            <div class="jp-duration"></div>
            <ul class="jp-toggles">
                <li><a href="javascript:;" class="jp-repeat" tabindex="1" title="repeat">repeat</a></li>
                <li><a href="javascript:;" class="jp-repeat-off" tabindex="1" title="repeat off" style="display: none; ">repeat off</a></li>
            </ul>
        </div>
        <div class="jp-title">
            <ul>
                <li></li>
            </ul>
        </div>
        <div class="jp-no-solution" style="display: none; ">
            <span>Update Required</span>
            To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
        </div>
    </div>
</div>

you can instantiate a player with this javascript

$(function() {
    $("#player").jPlayer({
        swfPath: "http://www.jplayer.org/latest/js/Jplayer.swf",
        supplied: "mp3",
        ready: function() {
            $(this).jPlayer("setMedia", {
                mp3:"http://static1.grsites.com/archive/sounds/animals/animals001.mp3"
            });
        }
    });         
});

this renders plain, unstyled HTML in your browser. You can style your jPlayer GUI as you please. For example, by adding some positioning rules

.jp-play, .jp-pause {
    position:absolute;
    left: 7em;
    top: 3em
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文