Trying to make these gooey CSS moving blobs. The basic setup seems to be that you give the circles blur and then add contrast to their container. The issue is that whenever I do that with custom colors the entire element just disappears. I tried it on these demos and same thing. Does anyone know why or know a workaround?
Here is a tutorial I've been following:
https://css-tricks.com/shape-blobbing-css/
Here is the code:
$(document).ready(function() {
$(".dot").hover(function() {
var cur = $(this);
var dest = cur.position().left;
var t = 0.6;
TweenMax.to($(".select"), t, {
x: dest,
ease: Back.easeOut
})
});
var lastPos = $(".select").position().left;
function updateScale() {
var pos = $(".select").position().left;
var speed = Math.abs(pos - lastPos);
var d = 44;
var offset = -20;
var hd = d / 2;
var scale = (offset + pos) % d;
if (scale > hd) {
scale = hd - (scale - hd);
}
scale = 1 - ((scale / hd) * 0.35);
TweenMax.to($(".select"), 0.1, {
scaleY: scale,
scaleX: 1 + (speed * 0.06)
})
lastPos = pos;
requestAnimationFrame(updateScale);
}
requestAnimationFrame(updateScale);
$(".dot:eq(0)").trigger("mouseover");
})
.text {
position: relative;
left: 110px;
top: 10px;
font-family: 'Baskerville', Georgia, serif;
font-size: 17px;
}
a {
color: inherit;
}
.dots {
list-style-type: none;
background: white;
-webkit-filter: blur(5px) contrast(10);
padding: 0;
margin: 0;
padding-top: 20px;
padding-bottom: 20px;
padding-left: 20px;
margin-left: -10px;
padding-right: 10px;
position: relative;
left: 100px;
top: 30px;
}
.dot {
display: inline-block;
vertical-align: middle;
border-radius: 100%;
width: 30px;
height: 30px;
background: black;
margin-left: 5px;
margin-right: 5px;
cursor: pointer;
color: white;
position: relative;
z-index: 2;
}
.select {
display: block;
border-radius: 100%;
width: 40px;
height: 40px;
background: black;
//opacity:0.6;
//transition:transform 300ms ease-in-out;
position: absolute;
z-index: 3;
top: 15px;
left: 0px;
pointer-events: none;
}
<div class="text">
<h1>Gooey pagination</h1>
Based on a dribbble by Kreativa Studio. <br />
Made by Lucas Bebber. <br /> <br />
Hover on the dots bellow
</div>
<ul class="dots">
<li class="select"></li>
<li class="dot"></li>
<li class="dot"></li>
<li class="dot"></li>
<li class="dot"></li>
<li class="dot"></li>
</ul>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.13.1/TweenMax.min.js"></script>
If you go to one of their demos and try changing the color to something like pink or #A0D9A8 you'll see what I mean:
This is really interresting. It seems that to work the color must cause a very strong contrast because of the filter rule used. So you will have to use flashy colors to make them appear. The colors pink or #A0D9A8 aren't flashy enought for the blur that's going to make him disappear. So try to use more flashy colors like #e83ce8 that's like a pink color:
$(document).ready(function() {
$(".dot").hover(function() {
var cur = $(this);
var dest = cur.position().left;
var t = 0.6;
TweenMax.to($(".select"), t, {
x: dest,
ease: Back.easeOut
})
});
var lastPos = $(".select").position().left;
function updateScale() {
var pos = $(".select").position().left;
var speed = Math.abs(pos - lastPos);
var d = 44;
var offset = -20;
var hd = d / 2;
var scale = (offset + pos) % d;
if (scale > hd) {
scale = hd - (scale - hd);
}
scale = 1 - ((scale / hd) * 0.35);
TweenMax.to($(".select"), 0.1, {
scaleY: scale,
scaleX: 1 + (speed * 0.06)
})
lastPos = pos;
requestAnimationFrame(updateScale);
}
requestAnimationFrame(updateScale);
$(".dot:eq(0)").trigger("mouseover");
})
.text {
position: relative;
left: 110px;
top: 10px;
font-family: 'Baskerville', Georgia, serif;
font-size: 17px;
}
a {
color: inherit;
}
.dots {
list-style-type: none;
background: white;
-webkit-filter: blur(5px) contrast(10);
padding: 0;
margin: 0;
padding-top: 20px;
padding-bottom: 20px;
padding-left: 20px;
margin-left: -10px;
padding-right: 10px;
position: relative;
left: 100px;
top: 30px;
}
.dot {
display: inline-block;
vertical-align: middle;
border-radius: 100%;
width: 30px;
height: 30px;
background: #e83ce8;
margin-left: 5px;
margin-right: 5px;
cursor: pointer;
color: white;
position: relative;
z-index: 2;
}
.select {
display: block;
border-radius: 100%;
width: 40px;
height: 40px;
background: #e83ce8;
position: absolute;
z-index: 3;
top: 15px;
left: 0px;
pointer-events: none;
}
<div class="text">
<h1>Gooey pagination</h1>
Based on a dribbble by Kreativa Studio. <br />
Made by Lucas Bebber. <br /> <br />
Hover on the dots bellow
</div>
<ul class="dots">
<li class="select"></li>
<li class="dot"></li>
<li class="dot"></li>
<li class="dot"></li>
<li class="dot"></li>
<li class="dot"></li>
</ul>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.13.1/TweenMax.min.js"></script>
Check what it says on the entire page over on CSS tricks, about brightness especially.
You just need to change the following and you will see pink blorbs.
.dots{
...
-webkit-filter: blur(5px) contrast(10) brightness(-50);
...
}
.dot {
...
background: /* black */ pink;
...
}
.select { /* EDIT */
...
background: /* black */ pink;
...
}
EDIT: I used a CSS variable in this fiddle:
https://jsfiddle.net/p97qxzew/
Related
I made a pop-up window and used transition animation in CSS.
When I open the pop-up window, there is no problem with the transition animation, but when the pop-up window is closed, there will be residual border lines on the page.
This happens in Google Chrome.
Please click here for details:
https://codepen.io/lianflower/pen/zYKRPJb
<button data-modal-target="#modal">Open Modal</button>
<div class="modal" id="modal">
<div class="modal-header">
<div class="title">Example Modal</div>
<button data-close-button class="closebutton">×</button>
</div>
<div class="modal-body">
A wiki (/ˈwɪki/ (About this soundlisten) WIK-ee) is a hypertext publication collaboratively edited and managed by its own audience directly using a web browser. A typical wiki contains multiple pages for the subjects or scope of the project and may be either open to the public or limited to use within an organization for maintaining its internal knowledge base
</div>
</div>
<div id="overlay"></div>
*,*::after, *::before {
box-sizing: border-box;
}
.modal {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scale(0);
transition: 500ms ease-in-out;
border: 1px solid black;
border-radius: 10px;
z-index: 10;
background-color: white;
width: 800px;
max-width: 80%;
}
.modal.active {
transform: translate(-50%, -50%) scale(1);
}
.modal-header {
padding: 10px 15px;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid black;
}
.modal-header .title {
font-size: 1.25rem;
font-weight: bold;
}
.modal-header .close-button {
cursor: pointer;
border: none;
outline: none;
background: none;
font-size: 1.25rem;
font-weight: bold;
}
.modal-body {
padding: 10px 15px;
}
#overlay {
position: fixed;
opacity: 0;
transition: 200ms ease-in-out;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, .5);
pointer-events: none;
}
#overlay.active {
opacity: 1;
pointer-events: all;
}
var openModalButtons = document.querySelectorAll('[data-modal-target]');
var closeModalButtons = document.querySelectorAll('[data-close-button]');
var overlay = document.getElementById('overlay');
openModalButtons.forEach(button => {
button.addEventListener('click', () => {
var modal = document.querySelector(button.dataset.modalTarget);
openModal(modal)
})
});
closeModalButtons.forEach(button => {
button.addEventListener('click', () => {
var modal = button.closest('.modal');
closeModal(modal)
})
});
overlay.addEventListener('click', () => {
var modals = document.querySelectorAll('.modal.active');
modals.forEach(modal => {
closeModal(modal)
});
});
function openModal(modal) {
if (modal == null) return;
modal.classList.add('active');
overlay.classList.add('active')
}
function closeModal(modal) {
if (modal == null) return;
modal.classList.remove('active');
overlay.classList.remove('active')
}
You modal has a border, border: 1px solid black; That is causing this thing to happen. Put border on modal.active class instead and you are good to go.
Update: Set your borders only when the modal is active on any of the children components of modal in order to avoid these extra lines.
Codepen:https://codepen.io/emmeiWhite/pen/MWjQrJd
Full Code:
var openModalButtons = document.querySelectorAll('[data-modal-target]');
var closeModalButtons = document.querySelectorAll('[data-close-button]');
var overlay = document.getElementById('overlay');
openModalButtons.forEach(button => {
button.addEventListener('click', () => {
var modal = document.querySelector(button.dataset.modalTarget);
openModal(modal)
})
});
closeModalButtons.forEach(button => {
button.addEventListener('click', () => {
var modal = button.closest('.modal');
closeModal(modal)
})
});
overlay.addEventListener('click', () => {
var modals = document.querySelectorAll('.modal.active');
modals.forEach(modal => {
closeModal(modal)
});
});
function openModal(modal) {
if (modal == null) return;
modal.classList.add('active');
overlay.classList.add('active')
}
function closeModal(modal) {
if (modal == null) return;
modal.classList.remove('active');
overlay.classList.remove('active')
}
*,*::after, *::before {
box-sizing: border-box;
}
.modal { /* Removed border from is selector */
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scale(0);
transition: 500ms ease-in-out;
border-radius: 10px;
z-index: 10;
background-color: white;
width: 800px;
max-width: 80%;
}
.modal.active {
transform: translate(-50%, -50%) scale(1);
border: 1px solid black; /*--- Added border here ---*/
}
.modal-header {
padding: 10px 15px;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid black;
}
.modal-header .title {
font-size: 1.25rem;
font-weight: bold;
}
.modal-header .close-button {
cursor: pointer;
border: none;
outline: none;
background: none;
font-size: 1.25rem;
font-weight: bold;
}
.modal-body {
padding: 10px 15px;
}
.modal-body.active{ /* Add border on active class only */
border:1px solid blue;
}
#overlay {
position: fixed;
opacity: 0;
transition: 200ms ease-in-out;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, .5);
pointer-events: none;
}
#overlay.active {
opacity: 1;
pointer-events: all;
}
<button data-modal-target="#modal">Open Modal</button>
<div class="modal" id="modal">
<div class="modal-header">
<div class="title">Example Modal</div>
<button data-close-button class="closebutton">×</button>
</div>
<div class="modal-body">
A wiki (/ˈwɪki/ (About this soundlisten) WIK-ee) is a hypertext publication collaboratively edited and managed by its own audience directly using a web browser. A typical wiki contains multiple pages for the subjects or scope of the project and may be either open to the public or limited to use within an organization for maintaining its internal knowledge base
</div>
</div>
<div id="overlay"></div>
This is what I'm trying to achieve
<pre>
CONTAINER External Events Box Shrink or Enlarge
<-------------------------------------------------------------------------------------------->
| Text LEFT(ED) internal CONTAINER |
| -------------- -------------------------------------------------- -------------- |
| | Info li | |Content li | | Info li | |
| | wrapped into | |shrink or enlarge to contents OR | | wrapped into | |
| | hollow circle1| |max size: (External container width - 2X(info li)| | hollow circle2| |
| -------------- |--------------------------------------------------- --------------- |
---------------------------------------------------------------------------------------------
</pre>
1- Hollow circles on the right side sould be all aligned (See picture)
2- Hollow circles on the left side sould be all aligned (See picture)
3- Extend(Enlarge or Schrink) dynamically the external
events box to wrap externally the hollow circles(One on the left + the
second on the right + Text container(holding the description name lines).
N.B:
If the first name line in bold reach the red Line
(see the following picture) it must not continue
on a second line( means the first line should be
always an inline bold block) and hence push
forward to extend the gray container.
If the second line written in smaller caracters reach the red Line
(see the following picture) it must break down into a thirth line fourth and
so on until it complets.
(each tuple(hollowCircle1,nameLines,hollowCircle2) is enclosed in its own
wrapper ul.
<body ng-controller="MainCtrl">
<div id='external-events'>
<h4 >Draggable books</h4>
<li style="display: inline;margin: 0;padding: 0;border: none;list-style-type: none;" ng-repeat="book in books track by $index"
id="book.id">
<ul style="margin: 0;padding: 0;border: none;list-style-type: none; display: flex;" class="fc-event" data-drag="true" data-jqyoui-options="{revert: 'invalid'}" jqyoui-draggable="{index {{$index}},placeholder:true,animate:true}">
<li style="margin: 0;padding: 0;border: none;list-style-type: none; display: inline;" class="circle" >
0</li><br><br><br><br>
<li style="margin: 0;padding: 0;border: none;list-style-type: none; display: inline;" ng-bind-html="book.content['name']"</li>
<li style="margin: 0;padding: 0;border: none;list-style-type: none; display: inline;" class="circle" >
2/10<br></li>
</ul>
</li>
</div>
<div id='calendar-container'>
<div id='calendar'></div>
</div>
</body>
CSS
ul {
list-style-type: none;}
ul.columns>li {
display: inline-block;
padding-right: 0cm;
margin-left: 0px;
}
ul.columns>li:before {
content:"";
display: list-item;
position: absolute;
}
h4 {
color: white;
display: inline;
border-bottom: 3px solid darken($fendersblue, 10);
padding-bottom: 8px;
line-height: 1.75em;
}
.fancy3 {
background-color: darken($fendersblue, 5);
}
#calendar
{
padding: 0 10px;
width: 650px;
float: right;
margin: 0px 0px 10px 55px;
}
#external-events {
width: 500px;
padding: 0 0px;
border: 0px solid #ccc;/* gray moyen*/
background: #eee;/* #5D6D7E;(Blue mat) */ /* #eee color gray*/
text-align: left;
}
#external-events h4 {
font-size: 30px;
margin-top: 0;
padding-top: 1em;
color:gray;
}
#external-events .fc-event {
cursor: pointer;
position:relative;
z-index: 100;
background: #eee;
}
#external-events p {
margin: 0 18em 0 0;
font-size: 14px;
font-weight: bold;
color: gray; /* color gray */
}
.circle {
position: relative;
display: inline-block;
width: 10%;
height: 25%;
padding: 0 0px;
border-radius: 360px;
/* Just making it pretty */
#shadow: rgba(0, 0, 0, .1);
#shadow-length: 4px;
-webkit-box-shadow: 0 #shadow-length 0 0 #shadow;
box-shadow: 0 #shadow-length 0 0 #shadow;
text-shadow: 0 #shadow-length 0 #shadow;
background: #FFFFFF;/*color white*/
color: #f05907;/* color red*/
font-family: Helvetica, Arial Black, sans;
font-size: 10;
text-align: center;
}
p span
{
display: block;
}
p:first-line {
color: gray;
font-size: 25px;
font-weight: bold italic;
}
p {
white-space: pre
}
Css is included in my CodePen
Many Thanks.
The content of your CodePen was a bit of a mess of invalid HTML, illogical use of markup, conflicting styles and seemingly arbitrary (and confusing) mixture of inline styles and CSS definitions.
There was too much to go into specifics. However, here is a version which gets you much closer to the layout you envisaged, I hope:
HTML:
<!DOCTYPE html>
<html ng-app="app">
<head>
<meta charset="utf-8" />
<title>AngularJS Plunker</title>
<script>document.write('<base href="' + document.location + '" />');</script>
<script data-require="angular.js#1.0.x" src="https://code.angularjs.org/1.2.8/angular.min.js" data-semver="1.0.7"></script>
</head>
<body ng-controller="MainCtrl">
<div id='external-events'>
<h4 >Draggable books</h4>
<ul data-drag="true" data-jqyoui-options="{revert: 'invalid'}" jqyoui-draggable="{index {{$index}},placeholder:true,animate:true}">
<li class="fc-event" ng-repeat="book in books track by $index"
id="book.id">
<div class="circle">0</div>
<div class="left content" ng-bind-html="book.content['name']"></div>
<div class="left rating">2/10</div>
<div class="clear"></div>
</li>
</ul>
</div>
<div id='calendar-container'>
<div id='calendar'></div>
</div>
</body>
</html>
CSS:
ul {
list-style-type: none;
}
ul>li {
display:block;
padding-right: 0cm;
margin-left: 0px;
}
h4 {
color: gray;
display: inline;
border-bottom: 3px solid darken($fendersblue, 10);
padding-bottom: 8px;
font-size:600;
}
#calendar{
padding: 0 10px;
width: 650px;
float: right;
margin: 0px 0px 10px 55px;
}
#external-events {
width: 500px;
padding: 0 0px;
border: 0px solid #ccc;/* gray moyen*/
background: #eee;/* #5D6D7E;(Blue mat) */ /* #eee color gray*/
text-align: left;
}
#external-events .fc-event {
cursor: pointer;
z-index: 100;
background: #eee;
border: solid 1px black;
border-radius: 2px;
margin-bottom:5px;
}
.content span
{
color: gray;
}
.fc-event span:first-child
{
font-size: 25px;
font-weight: bold italic;
}
.fc-event div
{
padding:3px;
margin-right:5px;
height: 100%;
}
.content
{
float:left;
max-width:75%;
}
.clear
{
clear:both;
}
.circle {
float:left;
width: 10%;
height: 25%;
padding: 0 10px;
border-radius: 360px;
/* Just making it pretty */
#shadow: rgba(0, 0, 0, .1);
#shadow-length: 4px;
-webkit-box-shadow: 0 #shadow-length 0 0 #shadow;
box-shadow: 0 #shadow-length 0 0 #shadow;
text-shadow: 0 #shadow-length 0 #shadow;
background: #FFFFFF;/*color white*/
color: #f05907;/* color red*/
font-family: Helvetica, Arial Black, sans;
font-size: 10;
text-align: center;
}
.rating
{
float:right;
background: #FFFFFF;/*color white*/
color: #f05907;/* color red*/
font-family: Helvetica, Arial Black, sans;
font-size: 10;
text-align: center;
border-radius: 360px;
}
JS:
var app = angular.module("app", []);
app.controller("MainCtrl", ['$scope', '$sce', function($scope, $sce){
$scope.books = [
{
id: 'id1',
content: {
name: '<span>Alain du sceau france</span><br><span> Canada Madagascar philipine</span>',
price: 'price1',
date: 'd1'
}
},
{
id: 'id2',
content: {
name: '<span>Name zu Long zu Schreiben Bis Here ist Ein Beispiel</span><br><span>Maneschester Canada Madagascar philipine</span>',
price: 'price2',
date: 'd2'
}
},
{
id: 'id3',
content: {
name: '<span>name Aleatoire Schwer und zu Leicht Zu Schreiben</span><br><span>Mexico Canada USA France Uk Deutschland Schweiz Madagascar philipine</span>',
price: 'price3',
date: 'd3'
}
}
];
$scope.books.forEach(function(book) {
book.content.name = $sce.trustAsHtml(book.content.name);
})
// initialize the external events
// -----------------------------------------------------------------
$('#external-events .fc-event').each(function() {
// store data so the calendar knows to render an event upon drop
$(this).data('event', {
title: $.trim($(this).text()), // use the element's text as the event title
stick: true // maintain when user navigates (see docs on the renderEvent method)
});
// make the event draggable using jQuery UI
$(this).draggable({
zIndex: 999,
revert: true, // will cause the event to go back to its
revertDuration: 0 // original position after the drag
});
});
// initialize the calendar
// -----------------------------------------------------------------
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: true,
droppable: true, // this allows things to be dropped onto the calendar
drop: function() {
// is the "remove after drop" checkbox checked?
if ($('#drop-remove').is(':checked')) {
// if so, remove the element from the "Draggable Events" list
$(this).remove();
}
},
eventDragStop: function(event, jsEvent, ui, view ) {
if(isEventOverDiv(jsEvent.clientX, jsEvent.clientY)) {
//////////
$('#calendar').fullCalendar('removeEvents', event._id);
var el = $( "<div class='fc-event'>" ).appendTo('#external- events').text(event.id);
}
}
});
var isEventOverDiv = function(x, y) {
var external_events = $( '#external-events' );
var offset = external_events.offset();
offset.right = external_events.width() + offset.left;
offset.bottom = external_events.height() + offset.top;
// Compare
if (x >= offset.left
&& y >= offset.top
&& x <= offset.right
&& y <= offset .bottom) { return true; }
return false;
}
}]);
CodePen demo: https://codepen.io/anon/pen/JwQOMQ?editors=1111
I have a video bar (#progressBar) that moves as the video is playing. The function works and updates correctly. But once the video is finished, the video bar isn't finished. This is what it looks like:
HTML
<div id="skin">
<video id="myMovie" width="640" height="360" autoplay>
<source src="videos/Queen - Killer Queen.mp4">
</video>
<nav>
<div id="buttons">
<i class="fa fa-pause" aria-hidden="true" id="playButton"></i>
</div>
<span id='current'>0:00 / </span> <span id='duration'> 0:00</span>
<div id="defaultBar">
<div id="progressBar"></div>
</div>
<div style="clear:both"></div>
</nav>
</div>
CSS
body {
text-align: center;
display: block;
}
nav {
margin: 5px 0px;
}
#myMovie {
width: 850px;
height: 480px;
}
#myMovie::-webkit-media-controls {
display: none;
}
#playButton {
position: relative;
top: -47px;
left: -294px;
padding: 10px;
padding-bottom: 13px;
padding-left: 20px;
padding-right: 20px;
color: white;
cursor: pointer;
}
#skin {
position: relative;
}
#defaultBar {
position: relative;
float: left;
top: -90px;
left: 481px;
width: 622px;
height: 3px;
background-color: #C2C2C2;
}
#progressBar {
position: absolute;
width: 0;
height: 3px;
background-color: #CA241E;
}
#current, #duration {
position: relative;
top: -77px;
left: -540px;
color: white;
font-family: Open Sans;
font-size: 13px;
}
#duration {
left: -540px;
}
JS
$(document).ready(function() {
$("#myMovie").on(
"timeupdate","play",
function(event) {
function format(s) {
m = Math.floor(s / 60);
m = (m >= 10) ? m : "0" + m;
s = Math.floor(s % 60);
s = (s >= 10) ? s : "0" + s;
return m + ":" + s;
}
var time = format(Math.floor(this.currentTime) + 1);
var duration = format(Math.floor(this.duration) + 1);
onTrackedVideoFrame(time,duration);
});
});
function onTrackedVideoFrame(currentTime, duration){
$("#current").text(currentTime + " / ");
$("#duration").text(duration);
}
$("#myMovie").on("ended",
function(event) {
alert("f");
});
function doFirst(){
barSize=575;
myMovie=document.getElementById('myMovie');
playButton=document.getElementById('buttons');
defaultBar=document.getElementById('defaultBar');
progressBar=document.getElementById('progressBar');
playButton.addEventListener('click', playOrPause, false);
defaultBar.onclick=clickedBar('click', clickedBar, false);
}
function playOrPause(){
if(!myMovie.paused && !myMovie.ended){
myMovie.pause();
playButton.innerHTML='<i class="fa fa-play" aria-hidden="true" id="playButton"></i>';
window.clearInterval(updateBar);
}else{
myMovie.play();
playButton.innerHTML='<i class="fa fa-pause" aria-hidden="true" id="playButton"></i>';
updateBar=setInterval(update, 500);
}
}
function update(){
var size=parseInt (myMovie.currentTime*barSize/myMovie.duration);
if(!myMovie.ended){
progressBar.style.width=size+'px';
}else{
progressBar.style.width=size+'px';
playButton.innerHTML='<i class="fa fa-play" aria-hidden="true" id="playButton"></i>';
window.clearInterval(updateBar);
}
}
function clickedBar(e){
if(!myMovie.paused && !myMovie.ended){
var mouseX=e.pageX-bar.offsetLeft;
var newTime=mouseX*myMovie.duration/barSize;
myMovie.currentTime=newTime;
progressBar.style.width=mouseX+'px';
}
}
window.addEventListener('load', doFirst, false);
I cant be sure as the code doesnt work for me at all when I'm copying it 1:1.
But it seems like you're initializing the variable barSize with the wrong value.
function doFirst(){
barSize=575;
...
"#defaultBar" seems to be the ProgressBar itself so the correct value to initialize barSize with should be 622:
function doFirst(){
barSize=622; // this should work
...
I'm using a pure CSS tooltip on this page: http://theroadmap.co/generation/
On small screen, hovering over some longer tooltips on right column causes tooltip to go off screen. Is there any way to get it to wrap when it reaches right end of screen?
Here is code for the tooltip:
/* TOOLTIP TIME */
.tooltip {
position: relative;
text-decoration: none;
}
.tooltip:hover:before {
display: block;
position: absolute;
padding: .5em;
content: attr(href);
min-width: 120px;
text-align: center;
width: auto;
height: auto;
white-space: nowrap;
top: -32px;
background: rgba(0,0,0,.8);
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
color: #fff;
font-size: 1.2em;
z-index: 1000;
}
.tooltip:hover:after {
position: absolute;
display: block;
content: "";
border-color: rgba(0,0,0,.8) transparent transparent;
border-style: solid;
border-width: 10px;
height: 0;
width: 0;
position: absolute;
top: -8px;
left: 1em;
}
var mousex = e.pageX + 20; //Get X coordinates
var mousey = e.pageY + 10; //Get Y coordinates
if((mousey+100)>$(window).height())
{
$('.tooltip')
.css({ top: mousey-100 ,left: mousex })
}
else if((mousex+200)>$(window).width())
{
$('.tooltip')
.css({ top: mousey ,left: mousex-200})
}
else
{
$('.tooltip')
.css({ top: mousey, left: mousex })
}
i had the same problem when i tried to display a file name. seems like the name was too long and there weren't any spaces in it, so i used
word-break: break-all;
in my .tooltip class.
this is my funtion for tooltip:
$('.file_attachments').hover(function () {
var tooltip = '<div class="tooltip"></div>';
// Hover over code
var title = $.trim($(this).attr('title'));
if (title.length > 0) {
$(this).data('tipText', title).removeAttr('title');
$('body').append(tooltip);
$('.tooltip').html(title);
$('.tooltip').fadeIn('slow');
} else {
$('body').append(tooltip);
}
}, function () {
// Hover out code
$(this).attr('title', $(this).data('tipText'));
$('.tooltip').remove();
}).mousemove(function (e) {
var mousex = e.pageX + 20; //Get X coordinates
var mousey = e.pageY + 10; //Get Y coordinates
$('.tooltip').css({top: mousey, left: mousex})
});
I have a drop down menu with css file and i want to convert it into Verctical menu I tried much but i can do that please anyone help me Folowing is my css and html code.anyone please tell me what exactly i am missing due to which menu is not converting
#sddmT
{ margin: 0;
padding: 0;
z-index: 30}
#sddmT li
{ margin: 0;
padding: 0;
list-style: none;
float: left;
font: bold 11px arial}
#sddmT li a
{ display: block;
margin: 0 1px 0 0;
padding: 4px 10px;
width: 60px;
background: #4A617B;
color: White;
text-align: center;
text-decoration: none}
#sddmT li a:hover
{ background: #BDCFD6;
color:#4A617B
}
#sddmT div
{ position: absolute;
visibility: hidden;
margin: 0;
padding: 0;
background: #4A617B;
border: 1px solid #BDCFD6}
#sddmT div a
{ position: relative;
display: block;
margin: 0;
padding: 5px 10px;
width: auto;
white-space: nowrap;
text-align: left;
text-decoration: none;
background: #4A617B;
color: #BDCFD6;
font: 11px arial}
#sddmT div a:hover
{ background: #BDCFD6;
color: #4A617B}
And her is html Code
<ul id="sddm">
<li>ETP
<div id="m1" onmouseover="mcancelclosetime()" onclick="mclosetime()">
<a href="http://dashboard.shakarganj.com.pk/ca/sml1etp.php" target=_blank>ETP - Jhang</a>
<a href="http://dashboard.shakarganj.com.pk/ca/sml2etp.php" target=_blank>ETP - Bhone</a>
</div>
</li>
</ul>
And here is my JS code to clos and open the menu items
<!--
var timeout = 500;
var closetimer = 0;
var ddmenuitem = 0;
// open hidden layer
function mopen(id)
{
// cancel close timer
mcancelclosetime();
// close old layer
if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
// get new layer and show it
ddmenuitem = document.getElementById(id);
ddmenuitem.style.visibility = 'visible';
}
// close showed layer
function mclose()
{
if(ddmenuitem) ddmenuitem.style.visibility = 'visible';
}
// go close timer
function mclosetime()
{
closetimer = window.setTimeout(mclose, timeout);
}
// cancel close timer
function mcancelclosetime()
{
if(closetimer)
{
window.clearTimeout(closetimer);
closetimer = null;
}
}
// close layer when click-out
//document.onclick = mclose;
// -->
upDate
I want like this
Try this:
#sddmT li { margin: 0;
padding: 0;
list-style: none;
position:static;
font: bold 11px arial; }
I know this is an old post, but I couldn't help noticing you have some whitespace between your main and sub-menus. Wrapping the submenus with the item that they point to will work, but you need to eliminate the whitespace, or you'll trigger the close/exit function every time you go to open the menu.
margin: 0 1px 0 0 vs margin:0.