Video.js controls at the top and pause doesn't function - css

I have my video-js player in a percentage width container, and it's finally resizing beautifully. However the controls are placed at the top of the video instead of the bottom, and the pause button will not work. Slider, volume, and fullscreen all work, but not pause. I've tried both 4.2 and 4.2.1 with no luck. If I use the version hosted here: "http://vjs.zencdn.net/c/video-js.css" the pause works, but the controls are still placed at the top.
I've tested this in both firefox and chrome with no luck.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="http://vjs.zencdn.net/4.2.1/video-js.css" rel="stylesheet">
<script src="http://vjs.zencdn.net/4.2.1/video.js"></script>
<script src="vidjs/z-skin.css" rel="stylesheet"></script>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<style type="text/css">
.BCLvideoWrapper {
position: relative;
padding-top: 0px;
padding-bottom: 56.25%;
height: 0;
}
* html .BCLvideoWrapper {
margin-bottom: 45px;
margin-top: 0;
width: 100%;
height: 100%;
}
.BCLvideoWrapper div,
.BCLvideoWrapper embed,
.BCLvideoWrapper object,
.BrightcoveExperience {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
}
</style>
</head>
<body>
<div id="indexvid">
<div class="BCLvideoWrapper">
<video id="QuickReel" class="video-js vjs-default-skin"
controls preload="auto" width="100%" height="auto" poster="images/reelthumbnail.jpg"
data-setup="{}">
<source src="media/reel.mp4" type='video/mp4' />
<source src="media/reel.webm" type='video/webm' />
</video>
</div><!--BCL--></div><!--indexvid-->
</body>
</html>

.BCLvideoWrapper div selects all divs that are descendants of .BCLvideoWrapper. As the video.js player consists of many divs (take a look in your browser's dev tools) this style has the unintended consequences you're seeing.
You should use .BCLvideoWrapper > div instead to match only divs that are (immediate) children of .BCLvideoWrapper, i.e. the div that video.js inserts in place of the original <video> element. The divs within that div won't match the rule.
.BCLvideoWrapper > div {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
}
Alternatively you could use .BCLvideoWrapper > .video-js to match just children with the .video-js class -- this would also match the unmodified <video> element in the event that javascript is disabled.
See this question for an expiation of the difference between child and descendant selectors

Related

Position items in a grid area

I'm making an editor app with a layout like google sheet or any simple web app with a thin, screenwide toolbar in the top and other stuff below. But... I'm having problem to position items in the toolbar. I plan to place:
a logo in the left corner
something in the middle
two buttons on the right side with specific order (like button A and B where B is closer to the right edge of the screen)
And most importantly i want to position these items inside the toolbar to be vertically in the center.
I tried so many things, but nothing really worked, except the very basic grid system below in which i want to place the items:
.layout {
height: 100vh;
display: grid;
grid-template-columns: 34% 33% auto;
grid-template-rows: 50px auto;
grid-template-areas:
"toolbar toolbar toolbar"
"searchbox resultbox editorbox";
}
.toolbar {
grid-area: toolbar;
}
.searchbox {
grid-area: searchbox;
}
.resultbox {
grid-area: resultbox;
}
.manju-editor {
grid-area: editorbox;
}
Can you pls tell me how could i position items the above described way?
Edit: per request the HTML also added, the app is created with create-react-app, so the html is its standard index.html and app is "assigned" to the root:
index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<title>React App</title>
</head>
<body>
<div id="root"></div>
</body>
</html>
render method from app.js:
<div className={userSession.layout.name}>
{userSession.layout.toolbar.active && <div className="toolbar">
{this.generateComponents("toolbar")}
</div>}
{userSession.layout.search.active && <div className="searchbox">
search
</div>}
{userSession.layout.results.active && <div className="resultbox">
result
</div>}
{userSession.layout.editor.active && <div className="editor">
editor
</div>}
</div>
You can try something like this:
/*
* containing div, position is relative, set the div height here
*/
.toolbar {
position: relative;
height: 30px;
}
/*
* all 3 children have absolute positioning
*/
.left {
position: absolute;
left: 0px;
top: 0px;
}
.right {
position: absolute;
right:0px;
top:0px;
}
.middle {
position: absolute;
top: 0px;
/* center the element */
left: 50%;
-webkit-transform: translateX(-50%);
transform: translateX(-50%)
}
<div class="toolbar">
<div class="left">left</div>
<div class="middle">middle</div>
<div class="right">right</div>
</div>
Ok, found the answer. It's here and working :)

Why isn't my background image showing up in CSS?

this is my first posting here and I am new to CSS. I am trying to get a sprite of Mario with dimensions of 32 x 16. When I open the html file nothing appears. I try to inspect element the html but I cannot see a div.
CSS
#stillMario {
width: 16px;
height: 32px;
margin: auto;
background-image: url("sprites/still.png");
position:absolute;
left: 0px;
top: 0px;
bottom:0px;
}
HTML
<!DOCTYPE html>
<html>
<head>
<title>Super Mario</title>
<link href="style.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="stillMario"></div>
<script src="myjs.js"></script>
</body>
</html>
If you are sure that the folder 'sprites' is in the root of your project, then try prefixing it with '../', then try without the absolute positioning first. If it works, then return the positioning again as follows;
#stillMario {
width: 16px;
height: 32px;
margin: auto;
background-image: url("../sprites/still.png");
//position:absolute;
//left: 0px;
//top: 0px;
//bottom:0px;
}
Let me know if it works
Use <img> element instead of setting the background of the <div>.
Example: <img src=""sprites/still.png"" alt="Mario" height="32" width="16">

How to make a responsive video with a width of 100% with no scroll?

The point is to have this video to always be 100% of the viewport width;
But to have the height just to a point where no scroll is needed.
Can this be achieved without using overflow:hidden; ?
You can copy paste the following as is.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Hello User!</title>
<style type="text/css">
div#video-border { border: 2px solid red; }
video { max-width: 100%; height: auto; width: 100%; }
</style>
</head>
<body>
<div>
<div>
Im the navigation!! Wupii
</div>
<div>
<p>I'm more text, more things</p>
<p>I'm more text, more things</p>
</div>
<div id="video-border">
<video controls="controls">
<source src="http://video-js.zencoder.com/oceans-clip.webm" type="video/webm" />
alt text
</video>
</div>
<div id="footer"><p>I'm the footer hello</p><p>I'm the footer yeah again</p></div>
</body>
</html>
To be honest, I'm not even sure if this solution will properly work. Not sure if the video will behave on those circumstances, still... wondering.
Please advice.
Agree with Patrick.
If you instead want to use it in a fixed, pre-calculated height box, use this:
div#video-border {
background-color: black;
border: 2px solid red;
}
video {
max-width: 100%;
width: 100%;
height: auto;
max-height: 150px; /* your desired height */
}

Can't get the Google Map div fixed

I'm trying to get the Google Map div fixed so it becomes always visible, but somehow the style property "position:fixed" is not working. The code is the following:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta name="layout" content="main" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px }
#map_canvas { height: 100% }
</style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
Some script
</script>
</head>
<body onload="initialize()">
<div class="nav">
First div
</div>
<div id="artistList">
Second div
</div>
<div id="map_canvas" style="position: fixed; right: 0px; top: 0px; width: 100%; height: 100%">
Map div
</div>
</body>
</html>
Any help? Thanks very much
This will solve it:
<div id="fixed" style="position:fixed; top:0">
<div id="map_canvas" style="width:100%; height:100%">
[map content goes here]
</div>
</div>
You should clean up your code a little to make things more visible. At first you should move the css style settings from your map_canvas into your css section in the html head. What remains is a clean <div id="map_canvas"></div>. Now let's head to your CSS section in the html head. Try it like this:
<style type="text/css">
html {}
body {margin: 0px; padding: 10px }
#map_canvas {
position: fixed;
right: 0;
top: 0;
width: 90%;
height: 90%;
border:1px solid #f00;
margin:10px;
}
</style>
I removed the height:100%; from html and body. I reduced to sizes of the canvas from 100% to 90% and gave it a red border and a margin of 10px to make things more clear. The div is set in the upper right corner now and is fixed. I tested it on FF, Chrome, Safari and IE.
But now one little question... Does it make sense to make the canvas 100% wide and high?! The map_canvas would hide everything else in your html...?
Najeeb's solution did not work for me.
Changing the map elements css (from position:absolute to position:fixed) after the "tilesloaded" map event seemed to work.

CSS sticky footer does not work on the 8250 BlackBerry device

I wanted the footer on a mobile site I was working on to stick to the bottom of the page. I found the CSS Sticky Footer example by Ryan Fait and implemented it. On every browser I could conceivably test, I found the footer to stick nicely to the bottom.
And, then it happened. The clients complained about the footer throwing itself all over the place. On painfully requesting details, I found out that the problem occurred on only one model of BlackBerry mobile devices: the 8250 model. I pulled out a Windows VM, downloaded and installed the BlackBerry 8250 simulator, and sure enough, I saw the problem.
For a page the height of two BlackBerry screens, the footer sticks to the middle of the first screen, on top of everything else. The footer does not move as you scroll, and if you scroll down to the lower half of the page, the footer is not visible. It stays fixed to the middle of the top screen.
I will post the HTML and CSS to the end of this question. If I could get any pointers or clues as to why this is happening on the 8250 BlackBerry model, and not least, how it could be fixed, I would be very very grateful.
Thank you!
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=yes;"/>
<style type="text/css">
* { margin: 0; padding: 0; }
html { height: 100%; }
body { height: 100%; }
.page {
width: 100%;
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -4em;
}
.push {
height: 4em;
}
#footer {
clear: both;
position: relative;
z-index: 10;
height: 4em;
margin-top: -4em;
text-align: center;
}
</style>
</head>
<body>
<div class="page">
<!-- lots of other DIVs here for actual content -->
<div class="push"></div>
</div>
<div id="footer">
<!-- footer content over here -->
</div>
</body>
</html>
I found this jQuery Sticky Footer hack. I am not too sure of whether this is going to be something people would suggest I should go with. I've not tested it yet, though.
Update: This is a small update to say that I toyed with the jQuery Sticky Footer hack linked right above. It didn't work for the BlackBerry device mentioned, either.
After trying a couple of different things, I stumbled into the CSSStickyFooter solution. I implemented it and found it to work well on the Black Berry device in question, along with the rest of everything I have tested it on. I am going to paste the HTML and CSS code below:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=yes;"/>
<title>Another CSS Sticky Footer that works on Black Berry</title>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
html {
height: 100%;
}
body {
height: 100%;
}
.page {
width: 100%;
min-height: 100%;
}
.push {
padding-bottom: 4em;
overflow: auto;
}
#footer {
position: relative;
margin-top: -4em;
height: 4em;
clear: both;
background-color: red;
}
</style>
</head>
<body>
<div class="page">
<div id="content">
<p>Some body content will come here</p>
<p>And over here as well.</p>
</div>
<div class="push"></div>
</div>
<div id="footer">
<p>This is the footer block.</p>
</div>
</body>
</html>

Resources