I've noticed when I'm watching a video and I click on the logo or a related video that a red progress bar (above the logo) dashes across the screen. At the same time there is a slight overlay to "grey" out the content then it fades in the new page. FYI, the URL changes to the new URL before the progress bar and transition happens.
The div ID of that bar is progress. Looks like some kind of cool jQuery ajax load but changing pages. I don't know.
YouTube is using the HTML5 History API to add and remove page URLs to the history stack. This results in the URL changing in the address bar, and the back/forward buttons working, while still actually loading the page via JS (ajax).
The easiest way to implement the API with backwards compatibility at this point is by using History.js. By backwards compatibility I mean falling back to the hash tag method for older browsers that do not support the HTML5 History API yet.
Check out the History.js demo!
I think Twitter is probably the best known example of a website using hashed URLs. For example twitter.com/#!/username has been a common sight for years. The problem with this method is that hash tags are client side, thus you need JS to read them and serve the proper content. Any non-JS user clicking a hashed URL will just land on Twitter's homepage.
Beatport was one of the first major websites using the HTML5 History technique by the way. SoundCloud has recently implemented it too. Both sites needed HTML5 History badly, to ensure audio playback while visitors browse through pages.
Youtube has open-sourced the library they use for dynamic navigation called spfjs.
Structured Page Fragments — or SPF for short — is a lightweight JS framework for fast navigation and page updates from YouTube.
Using progressive enhancement and HTML5, SPF integrates with your site to enable a faster, more fluid user experience by updating just the sections of the page that change during navigation, not the whole page. SPF provides a response format for sending document fragments, a robust system for script and style management, an in-memory cache, on-the-fly processing, and more.
looking at this demo, maybe could help you, and look at the comments, some say nice while some say too complicate to achieve it
html:
<div>
<dt></dt>
<dd></dd>
</div>
css:
#progress {
position: fixed;
z-index: 2147483647;
top: 0;
left: -6px;
width: 1%;
height: 2px;
background: #0088CC;
-moz-border-radius: 1px;
-webkit-border-radius: 1px;
border-radius: 1px;
-moz-transition: width 500ms ease-out,opacity 400ms linear;
-ms-transition: width 500ms ease-out,opacity 400ms linear;
-o-transition: width 500ms ease-out,opacity 400ms linear;
-webkit-transition: width 500ms ease-out,opacity 400ms linear;
transition: width 500ms ease-out,opacity 400ms linear;
}
#progress dd, #progress dt {
position: absolute;
top: 0;
height: 2px;
-moz-box-shadow: #0088CC 1px 0 6px 1px;
-ms-box-shadow: #0088CC 1px 0 6px 1px;
-webkit-box-shadow: #0088CC 1px 0 6px 1px;
box-shadow: #0088CC 1px 0 6px 1px;
-moz-border-radius: 100%;
-webkit-border-radius: 100%;
border-radius: 100%;
}
#progress dt {
opacity: .6;
width: 180px;
right: -80px;
clip: rect(-6px,90px,14px,-6px);
}
#progress dd {
opacity: .6;
width: 20px;
right: 0;
clip: rect(-6px,22px,14px,10px);
}
js:
$(document).ajaxStart(function() {
//only add progress bar if added yet.
if ($("#progress").length === 0) {
$("body").append($("<div><dt/><dd/></div>").attr("id", "progress"));
$("#progress").width((50 + Math.random() * 30) + "%");
}
});
$(document).ajaxComplete(function() {
//End loading animation
$("#progress").width("101%").delay(200).fadeOut(400, function() {
$(this).remove();
});
});
Related
I'm using ReactiveList to render results. What whould be the best way to override default inline-styles? Optimally remove all default styles provided by Reactivesearch (2.13.0).
E.g. How to remove these default styles provided by sortOptions in /packages/web/src/styles/result.js:
const sortOptions = css'
color: #424242;
height: 32px;
font-size: 0.82rem;
padding: 0 25px 0 10px;
background: url(base64....) no-repeat 95% 50%;
background-color: #fff;
-moz-appearance: none;
-webkit-appearance: none;
appearance: none;
-webkit-border-radius: 0;
border-radius: 0;
border: 0;
outline: 1px solid #ddd;
outline-offset: -1px;
';
I think, inner classes are the only way to merge the styling for now.
In your case the innerClass name will be sortOptions.
Please check the docs
https://opensource.appbase.io/reactive-manual/result-components/reactivelist.html#styles
The other alternative to use custom renderer, we can have render functions for every little component.
Every UI library comes with some default styling, the goal is to reuse the components with minimum efforts i.e one can easily extend & override the existing styles.
If you want the complete control over your UI components, I'll suggest custom render functions rather than the innerClass.
I'm working on a WebRTC UI that shows the user's video in a small element located in front of the video of the person to whom the user is speaking.
Here's a working codepen:
https://codepen.io/VikR/pen/GXoXRp
CSS
#pipContainer {
position: relative;
top: 0;
left: 0;
width: 250px;
}
#otherCallerVideo {
position: relative;
top: 0;
left: 0;
width: 100%;
}
#myVideo {
width: 30%;
position: absolute;
bottom: 0;
right: 0;
transform: rotateY(-180deg);
z-index: 1000;
}
HTML
<p id="status">Loading room information...</p>
<div id="start">
<button onclick="start(event)">Start</button><br/>
</div>
<div id="pipContainer">
<video id="otherCallerVideo" playsInline="true" autoPlay></video>
<video id="myVideo" playsInline="true" autoPlay muted></video>
</div>
This works fine in Chrome and Firefox, but Safari OS X and IOS, don't seem to permit it. The user's video disappears. I've tried a lot of different ways, using z-index and different kinds of positioning, but I haven't yet found a way to get this to work in Safari.
Is it possible to do this in Safari?
I got this working. Here's an updated CodePen.
https://codepen.io/VikR/pen/Wgwwoa
The key was putting this overflow code in the video container:
#pipContainer {
position: relative;
width: 300px;
height: 300px;
border: 5px solid black;
overflow: scroll;
-webkit-overflow-scrolling: touch;
}
This was a tough one to track down. Googling "safari z-index video elements" reveals many people having difficulty with this with posts from 2011 to 2018 coming up on the first page of results. Many of the fixes that work in other cases didn't seem to work in this case, possibly because I am overlaying one video element on top of another. The fix that worked was found here.
Note 1: overflow: 'hidden' also works, and has the added benefit of hiding the scrollbars.
Note 2: I have the impression that it may not be possible to change the video dimensions via javascript. In my app I currently set them on the HTML render by reference to screen.height.
I have an iframe inside a popup for some reason in mobile safari once the iframe loads it's changing the size of the iframe to go beyond the screen dimensions and no matter what I do in inspector the computed style won't update.
The style that inspector shows is taking effect is (and works everywhere else including android):
.gc-lightbox > iframe {
background-color: #FFF;
height: 645px;
width: 900px;
position: relative;
border: 4px solid rgba(255, 255, 255, 0.5);
max-height: 90%;
max-width: 90%;
overflow: hidden;
border: none;
}
However, in mobile safari the "computed height" and "computed width" are way off (depending on which popup you initiate) they're up as high as 3000px tall and 700px wide. Inspector does not have the height: 900px or the max-height: 90% crossed out and even if I put style="width: 300px !important; height: 300px !important" directly on the iframe tag the computed values are still going past these values with no indication as to why.
Any clues?
Click on any of the campus tour links (as I said, it works as expected everywhere but mobile safari - even android)
http://www.georgiancollege.ca/new-campus-tours/
In one of my projects, Safari Computed Rules were not matching the Styles Rules. And like, you even adding !important directly to the inline style did not help.
The culprit turned out to be too many transition effects on the page. The transitions were on inputs and textareas (which we manipulated a lot with JS). Changing to this helped me out.
transition: none;
I'm using the border-image property on elements with an image file set as the border background. The border image file has transparency and it works as I want it in Chrome and Firefox.
However, in IE11, the transparent area "overwrites" the background image under the border. Is there a way to fix it? I'm using the same border image on elements with various background images so I'd rather not create separate non-transparent border images for each one.
This is what I have so far:
body {
background: #000;
}
div {
background-image: url(http://i.stack.imgur.com/7dzt1.jpg);
border-image: url(http://i.stack.imgur.com/Zf544.png) 14 round;
width: 300px;
height: 80px;
border-style: solid;
border-width: 14px;
border-radius: 5px;
}
<div></div>
Rendering comparison
border-image file:
background-image file:
Defining a border-image-width instead of border-width solves the issue in IE11. If you want to set a fallback, border-style: dashed seems to offer more consistent behaviour.
This seems like buggy behaviour but is maybe a simple difference in browser behaviour:
In Chrome, the border-width: 14px adds 14px each side and occurs without a border-style. The border-style has no affect when border-image-width is set.
In IE11, the border-width: 14px does not add 14px each side unless a border-style is set. The border-style does affect the positioning of the border-image, but only when set to solid.
Screenshot from IE11
Working Example
div {
background-image: url(http://i.stack.imgur.com/7dzt1.jpg);
border-image: url(http://i.stack.imgur.com/Zf544.png) 14 round;
border-image-width: 14px;
width: 300px;
height: 80px;
border-radius: 5px;
}
<div></div>
Is it possible to have a listview within jquery mobile with a filter search but instead of having the normal list we create a card view. So in other worlds we are still adding the <li></li> for the list but we are changing the list css to a class so that it shows like cards and not in its usual way.
Is that possible? do I need to disable some css or added a new class or something to that effect to ensure that the list looks different?
There is one implementation I was using: http://appcropolis.com/page-templates/list-of-cards/
I only hope it was updated to work with jQuery Mobile 1.3
Or you can eve do it by yourself if you know enough css. Only important thing is to change li width to lets say 50 % (pr less if you want margins), set it to float left and and full border around them. And that is that, you can do it on any listview implementation.
Working example: http://jsfiddle.net/Gajotres/NBv9B/
CSS:
.ui-listview li {
width: 44% !important;
margin: 2% !important;
float: left;
border: 1px solid #ccc !important;
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.25);
}