Using the following css i have some cards, that when i hover over them will show additional information using an inside div. However when the div becomes bigger because the extra div within the existing div will be shown, only the color change is animated, however the resizing of the card beacause of the extra info in it does not animate. Does anybody now a solution?
/* geschiedeniskaart */
.geschiedeniskaart
{
width:350px;
background-color: #E0F0FF;
box-shadow: 3px 3px 1px #888888;
margin-top:20px;
margin-left:5px;
transition: all 1s ease;
}
.geschiedeniskaartdatum
{
width:350px;
background-color: #001433;
box-shadow: 3px 3px 1px #888888;
margin-top:20px;
margin-left:5px;
}
.geschiedeniskaartdatum .tekst {
font-size:1.1 em;
margin-left:20px;
color: white;
line-height: 20px;
}
.geschiedeniskaart .tekst{
font-size:.9 em;
margin-left:20px;
color: #00004C;
line-height: 20px;
}
.geschiedeniskaart .visibletekst {
display:none;
transition: all 1s ease;
}
.geschiedeniskaart:hover {
background-color: white;
}
.geschiedeniskaart:hover .visibletekst {
display: block;
line-height : 30px;
}
The html looks something like this:
<div class="geschiedeniskaart">
<div class="row">
<div class="col-xs-12">
<span class="tekst">Title</span>
</div></div>
<div class="row visibletekst">
<div class="col-xs-6"><span class="tekst">I am visble when hovering over tittle</span></div><div class="col-xs-6"><span class="tekst">Date</span></div></div></div>
Do it all the way like this.
$(document).ready(function(){
var dd = $('dd');
var dt = $('dt');
dd.hide();
$('dl').on('mouseenter','dt',function(){
$(this).next().slideDown(400);
$('h1').fadeIn(1000);
dt.mouseleave(function(){
$(this).next().slideUp(400);
$('h1').fadeOut(1000);
});
/*can do the following as well:note the event delegationxx
$('dl').on('mouseenter','dt',function(){
$(this).next()
.show(400).
siblings('dd').
hide();
});*/
});
});
(function(){
$('<h1></h1>',{
text:"Hover for answers",
class: 'myclass'
}).prependTo('body');
})();
$('h1').click(function(){
$(this).hide('slow', function() {
$(this).insertAfter('p');
});
});
dl{padding:10px;text-align:center;background:silver;width:90%;margin:0 auto;border-radius:4px;}
dt{padding:5px;border:2px grey solid;font-size:2em;font-weight:bold;border-radius:5px;}
dd{font-size:1.5em;color:grey;}
h1 {font-size:1em;color:mediumpurple;}
.myclass{background:silver;text-align:center;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<dl>
<dt>HOW are you bro</dt>
<dd>very nice, thank you<p></p></dd>
<dt>HOW are you bro</dt>
<dd>very nice, thank you</dd>
<dt>HOW are you bro</dt>
<dd>very nice, thank you</dd>
<dt>HOW are you bro</dt>
<dd>very nice, thank you</dd>
</dl>
Related
Hello I really need your help. I have been googling around for how to make a tweet box like twitter's "What's happening" box for user to post new content using bootstrap 3 but so far I cannot find anything close.
Anyone have any idea or keyword that could help? Thank you very much!
You may find a lot of plugins to do the same . But If you want do it your own follow the below steps (this contain only basic functionality)
Define a span or div like below
<div class="container">
<div id="mockTextBox">
What's Happening ?
</div></br>
<textarea id="originalTextBox" class="form-control">
</textarea>
</div>
Hide the textarea at first and show the span/div as textbox.
Then define the events
$(document).ready(function(){
$('#originalTextBox').hide()
$('#mockTextBox').click(function(){
$('#mockTextBox').hide()
$('#originalTextBox').show()
})
})
Apply CSS accordingly and you got what you want.
#mockTextBox
{
width:300px;
height:50px;
border:1px solid;
}
#originalTextBox
{
width:300px;
height:50px;
resize:none;
}
Check this sample http://codepen.io/Midhun052/pen/mVByzK
I have add the bootstrap class to text area in the codepen above for that nice look.
Just updated
A few more CSS and Images
$(document).ready(function() {
$('#originalTextBox').hide()
$('#mockTextBox').click(function() {
$('#mockTextBox').hide()
$('#originalTextBox').show()
})
})
#mockTextBox
{
width:300px;
height:50px;
border:1px solid;
display:inline-block;
margin-top:10px;
border: 1px solid #337ab7;
}
#txt
{
border:1px solid;
display:inline;
height:20px;
}
#originalTextBox
{
width: 310px;
height: 100px;
resize: none;
border: 1px solid #337ab7;
background-color: #337ab7;
margin: 10px;
}
#originalTextBox textarea
{
resize:none;
margin:5px;
width:300px;
}
.class2
{
float: right;
margin-top: 12px;
margin-right: 2px;
}
.imgF1
{
width:20px;
height:20px;
margin:5px
}
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
<div class="container">
<div id="mockTextBox">
<img src="http://lorempixel.com/46/46"/>
<div id="txt">What's Happening ?</div>
<img class="class2" src="http://lorempixel.com/16/16"/>
</div>
<div id="originalTextBox">
<textarea class="form-control">
</textarea>
<img class="imgF1" src="http://lorempixel.com/46/46">Post your photo</img>
</div>
</div>
It's simple jQuery application.
Check this out.
Here's a JSFiddle.
Then all you gotta do is initiate the jQuery.
Such as:
$('textarea').autogrow({onInitialize: true});
Check fiddle for more info.
Cheers!
UPDATED ANSWER:
Use CSS to style your textarea, no need for javascrcipt styling here. Prepare your style in CSS under a specific class and when you need to, you can add your element this class and its propeties. This is much cleaner solution. Use focus and blur events to get textarea element. Here is example.
HTML
<textarea rows="4" cols="50" id="txtArea">
<textarea>
JS
$(document).ready(function() {
$('#txtArea').on("focus", function(event) {
if(!$('#txtArea').hasClass('customTextAreaClass')){
$('#txtArea').addClass('customTextAreaClass');
}
});
$('#txtArea').on("blur", function(event) {
if($('#txtArea').hasClass('customTextAreaClass')){
$('#txtArea').removeClass('customTextAreaClass');
}
});
});
CSS
.customTextAreaClass{
background-color: #fff;
width: 565px;
color: #000;
height: 120px;
padding-left: 1px;
padding-top: 1px;
font-family: "Tahoma", Geneva, sans-serif;
font-size: 10pt;
border: groove 1px #e5eaf1;
position: inherit;
text-decoration: none;
}
I'm making a menu selection bar, and I'm running into a problem when I mouse over. The icon's corners should all be curved, but only the left hand side ones are.
Here's a demo of the code: https://jsfiddle.net/gfqgcwq5/
From what I can tell, it seems like inline-block is the culprit here:
.wrapper{
display:inline-block;
margin:10px;
}
I just don't know how to accomplish the inline array without it. I'm not great at css, so if someone could lend me a hand, I'd appreciate it.
try this one:
.icon{
border-radius:8px;
padding-top:15px;
padding-bottom:5px;
transition:.1s;
font-size:60px;
display: inline-table;
}
.icon:hover{
cursor:pointer;
background-color: #00B1EB;
color:#fff;
}
span#picture > span {
padding-right:9px;
padding-left:10px;
padding-top:7px;
padding-bottom:10px;
}
.text{
text-align:center;
}
.wrapper{
display:inline-block;margin:10px;
}
DEMO HERE
Used to this
Define your .icon display inline-block
as like this
.icon{display:inline-block;line-height:60px;}
or you can used to
.icon{display:block;}
Demo
Remember that the border-radius is a property (in this case) of the .icon class, if you use the inspector you will see that the wrapper has the proper size and shapewraper
So as the other says the issue is on the display of the .icon class, If your idea is to have more than one .icon elements inside of the wrapper and inline, you should use display: inline-block;, if your call is to have just one per wrapper use display: block;.
Hope this helps you.
You gotta give icon block display: inline-block property in order to work !!
.icon {
border-radius: 8px;
padding: 15px;
padding-bottom: 5px;
transition: .5s all ease;
font-size: 60px;
display: inline-block;
}
.icon:hover {
cursor: pointer;
background-color: #00B1EB;
color: #fff;
}
span#picture > span {
padding-right: 9px;
padding-left: 10px;
padding-top: 7px;
padding-bottom: 10px;
}
.text {
text-align: center;
}
.wrapper {
display: inline-block;
margin: 10px;
}
<link href="https://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet"/>
<div class="wrapper">
<span id="picture" class="icon"><span class="glyphicon glyphicon-picture"></span></span>
<div class="text">PICTURES</div>
</div>
<div class="wrapper">
<span id="picture" class="icon"><span class="glyphicon glyphicon-picture"></span></span>
<div class="text">PICTURES</div>
</div>
<div class="wrapper">
<span id="picture" class="icon"><span class="glyphicon glyphicon-picture"></span></span>
<div class="text">PICTURES</div>
</div>
<div class="wrapper">
<span id="picture" class="icon"><span class="glyphicon glyphicon-picture"></span></span>
<div class="text">PICTURES</div>
</div>
Apply padding for the text div to allow the entire curve to visible.
.text{
text-align:center;
padding:0px 7px;
}
DEMO
I have following html code but the TasksCount class does not show up as hyperlink. Any idea? I updated the anchor with the wording Link but still no good.
<div id="TaskNotification" style="display: inline!important; float: left; border; 3px solid #8AC007;PADDING: 5px;">
<img id="NotificatioImg" class="n-img" "="" src="../SiteAssets/tasks_sm.png?rev=23" alt="Notification">
<div class="TasksCount">
Link
</div>
</div>
Here is the CSS
<style>
body {
font-family:Calibri;
}
#customTaskNotification {
position:relative;
}
.TasksCount {
position:absolute;
top: -.1px;
right:-.1px;
padding:1px 2px 1px 2px;
background-color:#ff0000; /* orange #ef8913* dark-pink #d06079 */
color:white;
font-weight:bold;
font-size:1.05em;
width:50%;
text-align: center;
border-radius:50%!important;
box-shadow:1px 1px 1px gray;
}
div.TasksCount:empty {
display: none;
}
</style>
Here is the jQuery that populates TasksCount Div
<script type="text/javascript" language="javascript" src="_layouts/15/jquery/jquery-2.1.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var rowCount = $(".ms-WPBody tr").not(":has(th)").length;
var x = $('.ms-WPBody tr td a').html();
if(x.indexOf("There are no items") !== -1){
rowCount = "";
}
$(".rowCount").text(rowCount);
$(".TasksCount").text(rowCount);
});
</script>
<div id="TaskNotification" style="display: inline!important; float: left; border; 3px solid #8AC007;PADDING: 5px;">
<img id="NotificatioImg" class="n-img" "=" src="../SiteAssets/tasks_sm.png?rev=23" alt="Notification">
<div class="TasksCount">
Link
</div>
</div>
The anchor tag has no text. Just put in some text.
Not what you are looking for? Let me know :)
Because you populate TaskCount overwriting the link? - try
$(".TaskCount>a").text(rowCount)
instead
<img class="n-img" "="" src="../SiteAssets/tasks_sm.png?rev=23" alt="Notification">
I am making a CSS design for a SIM game I play, and a customer asked for 4 boxes, two large and in between them, two horizontally aligned boxes. They work fine, unless I try and add headers. The entire website is set up in a ridiculous amount of tables, basically coding from the 90s. All boxes I have made are div and aligned to meet up with the existing boxes on the page.
The main boxes are how I want the headers on all four boxes, separate and do not scroll. However, as you can see from this fiddle, nothing is aligning. When I try to put headers on the horizontal boxes, it really messes up the align. I am a fairly new coder, and would greatly appreciate some help.
div {
display: block;
color: #fff;
}
.topcontain{
width:500px;
height:300px;
}
.topleftbox {
width:240px;
height:300px;
overflow:auto;
float:left;
background:#505665;
color:#fff;
text-align:center;
display:block;
font-family: 'Snippet', sans-serif;
font-size: 12px!important;
margin: 5px;
opacity: .75;
}
.toprightbox {
width:240px;
height:300px;
overflow:auto;
float:right;
background:#505665;
color:#fff;
text-align:center;
display:block;
font-family: 'Snippet', sans-serif;
font-size: 12px!important;
margin: 5px;
opacity: .75;
}
.bottomcontain {
width:500px;
height:300px;
}
.header {
width:500px;
float:center;
background:#060e23;
color:#fff;
text-align:center;
display:block;
font-size: 14px;
border: 1px solid #030711;
opacity: 1.0;
}
.bottombox {
width:500px;
height:300px;
overflow:auto;
float:center;
background:#505665;
font-size: 12px;
color:#fff;
text-align:center;
display:block;
font-family: 'Snippet', sans-serif;
opacity: .75;
}
.credit {
width:500px;
float:center;
background:#060e23;
color:#fff;
text-align:center;
display:block;
font-size: 12px;
border: 1px solid #030711;
opacity: .85;
}
.top {
font-family: 'Snippet', sans-serif;
background : #060e23;
color : #fff;
font-size : 15px;
padding : 5px 15px;
font-weight : normal;
text-align : center;
border: 1px solid #030711;
opacity: .90;
}
Here is how it looks on the page I am coding:
example
Thank you again!
http://jsfiddle.net/6bEsE/6/
<div class="bottomcontain">
<div class="header">Lorem ipsum</div>
<div class="bottombox">
[TOP]
</div>
</div>
<div class="topcontain">
<div class="topleftbox">
<div class="top">Lorem ipsum</div>
<div>
[MIDDLE LEFT]
</div>
</div>
<div class="toprightbox">
<div class="top">Lorem ipsum</div>
<div>
[MIDDLE RIGHT]
</div>
</div>
</div>
<div class="bottomcontain">
<div class="header">Lorem ipsum</div>
<div class="bottombox">
[BOTTOM]
</div>
</div>
<div class="credit">Layout and CSS by Echo [#15480]</div>
I did a fast clean of your code (5 minutes)
But it is far from finishing it
First of all, you have bad closing of divs.
Second, you have fixed height for divs. A div with fixed width and height and more text than can fit in it will create scrolls.
before inserting all that text, try to fix the containers starting from the simple example i provided above. Also you may need to change a bit the html structure, to group those floating middle divs.
Demo Fiddle
In CSS
.clear{
clear:both;
}
In HTML
<div class="clear"> </div>
How do I create centered <h1> with <hr/> on both sides over a background image?
I also need it to handle various text lengths, scale well for mobile viewing and have the <hr/> go to 100% width of its container.
I want this look, but over a background image.
There are lots of answers (here, here here and here) for text with lines on either side but all of them rely on using a solid background colour behind the text, which doesn't work for me as the page I want to put this on has a background image.
Here is how I achieve the look above, which handles various lengths of text and scales well:
CSS
.title-box {
height: 2px;
background-color: rgb(215, 0, 0);
text-align: center;
}
.title-outer {
background-color:rgb(230, 230, 230);
position: relative;
top: -0.7em;
}
.title-inner {
margin:0px 20px;
font-size: 17.5px;
font-weight:bold;
color:rgb(100, 100, 100);
}
HTML
<div class="title-box">
<span class="title-outer">
<span class="title-inner">OUR STORY</span>
</span>
</div>
I have tried the method below and it kind of works but it doesn't handle various text widths or scale well due to the <h1> and the <hr/>s being in seperate <div>s:
HTML
<div class="row">
<div class="span4"><hr /></div>
<div class="span4"><h4>OUR STORY</h4></div>
<div class="span4"><hr /></div>
</div>
Note: This is example is using the Bootstrap grid system but that is not part of the problem/solution.
So any ideas how I can get the same look and behaviour but without the backgound colour for the text so it can sit over a background image?
No need JS, here is a pure CSS solution.
CSS
.title-hr hr {
display: inline-block;
width: 30%;
margin: 5px 10px;
border-top: 1px solid #e5e5e5;
}
HTML
<h1 class="title-hr"><hr />My Title<hr /></h5>
Result: http://jsfiddle.net/yptmftr4/
Ok, I've played a bit with this code and here is my solution. Yes, it's a bit dirty because I've used :before and :after, but works.
HTML
<div class="title-box">
<span id="first" class="title-inner">OUR LOOOoo oooo oOONG STORY</span>
</div>
<div class="title-box">
<span id="second" class="title-inner">OUR STORY</span>
</div>
<div class="title-box">
<span id="third" class="title-inner">STORY</span>
</div>
CSS
.title-box {
text-align: center;
}
.title-inner {
margin:0px 20px;
font-size: 17.5px;
font-weight:bold;
position: relative;
color:rgb(100, 100, 100);
}
.title-inner:after, .title-inner:before {
content:"";
float: right;
position: relative;
top: 8px;
height: 2px;
background: red;
}
.title-inner:before {
float: left;
}
jQuery
$(document).ready(function () {
function work() {
$(".title-inner").each(function () {
var full_width = $(window).width();
var id = $(this).attr("id");
var title_width = $("#" + id).width();
var new_width = (full_width - title_width) / 2 - 40;
$('head').append("<style>#" + id + ":before, #" + id + ":after{width:" + new_width + "px !important;}</style>");
});
}
work();
$(window).resize(function () {
work();
});
});
http://jsfiddle.net/ffb3X/4/
Because :before and :after are not part of DOM, I've used .append() function to append style tags in head for every title.
This code will on page load calculate everything, so it's responsive.
This code was posted originally by Arbel but his/her answer disappeared for some reason? I am reposting it (including some mods I've made) because it was the solution I ended up using. Credit where credit is due.
Working jsFiddle: http://jsfiddle.net/pA5Gu/
HTML
<div class="title-box">
<fieldset class="title-outer">
<legend id="titleInner" class="title-inner">OUR STORY</legend>
</fieldset>
</div>
CSS
.title-box {
background-image: url('http://imagezo.com/images/1302-green-bubbles-awesome-background-wallpaper.jpg');
height:100%;
}
.title-outer {
border-top:2px solid rgb(215, 0, 0);
background-color: transparent;
}
.title-inner {
width:auto;
padding:0px 20px;
border: 0;
background-color: transparent;
font-size: 17.5px;
font-weight:bold;
color:rgb(255, 255, 255);
}
jQuery
$(document).ready(function() {
var legendWidth = $('#titleInner').outerWidth();
var margin = 'calc((100% - '+legendWidth+'px) / 2)';
$('#titleInner').css('margin-left', margin);
$('#titleInner').css('margin-right', margin);
});
http://jsfiddle.net/habo/HrfuH/1/
<div class="title-box">
<div class="myContent">
<div class="title-outer"><hr /></div>
<div class="title-inner "><h4>OUR STORY</h4></div>
<div class="title-outer"><hr /></div>
</div>
</div>
.myContent{
display:block;
width:600px;
margin:0 auto;
}
.title-box {
background:#eee;
height:60px;
}
.title-outer{
}
hr {
height: 2px;
background-color:rgb(215, 0, 0);
margin: 2em 0;
width:25%;
float:left;
}
.title-inner {
margin:0px 20px;
font-size: 17.5px;
font-weight:bold;
color:rgb(100, 100, 100);
float:left;
}