I have a 2 columns layout inside 2 divs with different margins set, on the left column I have a bootstrap datetimepicker and summernote.
As you can see the datetimepicker dialog overflows outside the internal div, how can I achieve the same with summernote's dropdowns? Is it possible?
Here's my playground with the issue: https://jsfiddle.net/SycoLTH/2j0ykbgf/
<style>
form {
height: 100%;
width: 100%;
}
#out-container {
background-color: #000000;
margin: 0;
padding: 0;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
display: flex;
}
#in-container {
background-color: #FFFFFF;
width: 100%;
height: 100%;
max-height: 80%;
max-width: 70%;
margin: auto;
padding: 3%;
}
#column-left,
#column-right {
height: 100%;
width: 50%;
overflow: auto;
}
</style>
<script type="text/javascript">
$(".datetimepicker").datetimepicker({
showClear: true,
showTodayButton: true
});
$(".summernote").summernote({
theme: "simplex",
disableDragAndDrop: true,
shortcuts: false,
toolbar: [
["style", ["bold", "italic", "underline", "clear"]],
["misc", ["undo", "redo"]],
["font", ["strikethrough", "superscript", "subscript"]],
["fontsize", ["fontsize"]],
["color", ["color"]],
["para", ["ul", "ol", "paragraph"]],
["insert", ["picture", "link", "video", "table", "hr"]],
["height", ["height"]]
]
});
</script>
<div id="out-container">
<div id="in-container">
<form>
<div id="column-left" class="pull-left">
Some text
<br> Some text
<br> Some text
<br> Some text
<br> Some text
<br> Some text
<br>
</div>
<div id="column-right" class="pull-left">
Date:
<br>
<input type="text" class="datetimepicker form-control" />
<br>
<br> Text:
<br>
<textarea class="summernote"></textarea>
</div>
</form>
</div>
</div>
position: absolute objects are cropped by the bound of its nearest position: relative object. In this case, the easiest way to show summernote popovers over the boundary, try to set the right column as below.
#column-right {
overflow:visible;
}
Ref: http://front-back.com/how-to-make-absolute-positioned-elements-overlap-their-overflow-hidden-parent
Related
I have this code in my vue app
<form class="d-flex me-auto" id="searchBar">
<div class="input-group">
<input class="form-control" type="text" placeholder="Cerca professionista" #keyup="search" aria-label="Search" v-model="searchInput">
<button class="btn btn-outline-success" #click.prevent="search">
<i class="fa-solid fa-search"></i>
</button>
</div>
</form>
<div class="list-group" v-if="searchResults.length > 0" id="searchResultsList">
<a href="#" class="list-group-item list-group-item-action" v-for="(result, index) in searchResults" :key="index" id="searchResult" #click.prevent="showUserProfile(result.username)">
<div class="d-flex w-100 justify-content-between">
<p class="ps-2 me-auto mb-1">{{ result.name }} {{ result.surname }}</p>
<!-- <img :src="result.propicUrl" id="searchResultThumbnail"> -->
</div>
<small class="ps-2 me-auto">{{ result.category }}</small>
</a>
</div>
I will have a list that will contain the results of a search, since there are a lot of results, how I can make it scrollable? At the moment I have added this css rules but not working
<style lang="scss">
#menu {
height: 75px;
.navbar-brand {
padding-top: 0;
#logo {
width: 60px;
height: 60px;
}
}
#searchBar {
width: 420px;
}
#searchResultsList {
position: absolute;
top: 3.8em;
left: 5.4em;
width: 420px;
overflow-y: scroll;
#searchResult {
overflow-y: scroll;
#searchResultThumbnail {
height: 40px;
width: 40px;
border-radius: 50%;
}
}
}
}
</style>
You need to set either height or max-height to a value that results in a concrete size (e.g: 40vw, 200px, 20pt) for overflow-y: auto | scroll to have any effect.
Without setting the (max-)height, the element will grow to match the height of its children and will never display an active scrollbar.
Side note: considering the element has position: absolute, height: 100% will likely delegate the height request to the closest positioned ancestor but, again, you do need a positioned ancestor with a concrete height for overflow-y: auto | scroll to work.
Generic example:
Vue.createApp().mount('#app')
#app {
max-height: 100px;
overflow-y: auto;
border: 1px solid red;
}
<script src="https://unpkg.com/vue#next/dist/vue.global.prod.js"></script>
<div id="app">
<div v-for="n in 20">test</div>
</div>
Playground:
const { createApp, reactive, toRefs } = Vue;
createApp({
setup: () => ({
...toRefs(reactive({
setHeight: false,
setMaxHeight: true,
listLength: 20
}))
})
}).mount('#app')
#app {
display: flex;
}
#app>* {
flex: 0 0 50%;
}
.scroller {
overflow-y: auto;
border: 1px solid red;
}
.controls {
padding: 0 1rem;
display: flex;
flex-direction: column;
}
* {
box-sizing: border-box;
}
<script src="https://unpkg.com/vue#next/dist/vue.global.prod.js"></script>
<div id="app">
<div class="scroller" :style="{ height: setHeight ? '100px' : '', maxHeight: setMaxHeight ? '100px': ''}">
<div v-for="n in listLength">test</div>
</div>
<div class="controls">
<div>
Items: <input type="number" v-model="listLength">
</div>
<label>
<input v-model="setHeight" type="checkbox">
Set height
</label>
<label>
<input v-model="setMaxHeight" type="checkbox">
Set max height
</label>
</div>
</div>
The difference between setting height and max-height is that with height the element will have the specified height even when it doesn't have enough content to fill it, while with max-height, when you don't have enough content, the element will shrink all the way down to 0 (unless something else gives it a soft min-height: e.g: a flex container).
I'm trying to make a pop-up options box appear next to each one of the elements of a file list. This window show the options available for that files.
I'm using an onClick function that toggle classes between one hidden and the other visible. My problem is that the box is placed always in the same place, despite the file you click, so it seems like you are always opening the options from the first file.
The React code:
return (
<div className='file-row'>
<div className='file-row-1'>
<div className='checkbox-iconFile-container'>
<input className='checkbox-folder' type="checkbox"/>
<p id={props.id} className='file-name'><img className='resourceIcon'alt='tipo de documento' src={resourceIcon}></img>{newStr}</p>
</div>
<p className='file-date'>{date}</p>
<p className='groups-file-text'>UBIP,...</p>
</div>
<div className='div-hidden-options'>
<ModalResources></ModalResources>
<div className='moreInfo-dots-container' onClick={showFileOptions}>
<img className='moreInfo-dots' alt='Opciones' src={dots}></img>
</div>
<div id='file-options' className='div-file-options-hidden'>
<p>Modificar tÃtulo</p>
<p>Modificar archivo</p>
<p>Mover recurso</p>
<p>Eliminar recurso</p>
</div>
</div>
</div>
)
The showFileOptions function :
function showFileOptions () {
let optionsDiv = document.getElementById('file-options');
optionsDiv.classList.toggle('div-file-options-show');
}
And the CSS:
.div-hidden-options {
width: 15%;
display: flex;
flex-direction: row;
justify-content: space-between;
}
.div-file-options-hidden {
visibility: hidden;
position: absolute;
}
.div-file-options-show {
visibility: visible;
position: absolute;
margin-left: 15%;
background-color: white;
border: 1px solid #DDDDDD;
padding: 5px;
border-radius: 5px;
margin-top: -36px;
}
And an image of the position that the box takes regardless of the file we click:
And this is the desirable behaviour of the box when the second file is clicked:
I am trying to align these four separate spliced images from an original image. I am doing this because each portion of the image has a separate link.
I have the images align. Now all I want to do is shrink the size of the images via width: #%;
For some reason this just isn't seeming to work.
Any help would be appreciated.
Here is a link to the CodePen: http://codepen.io/anon/pen/pvGgdp
.split,
.split2,
.split3,
.split4 {
display: inline-block;
margin: -2px;
}
.spliter {
margin-top: -3px;
}
<div class="splitWrapper">
<div class="split">
<a href="#">
<img src="http://i.imgur.com/Jnah8Y0.png" title="source: imgur.com" />
</a>
</div>
<div class="split2">
<a href="#">
<img src="http://i.imgur.com/mGftOCN.png" title="source: imgur.com" />
</a>
</div>
<div class="spliter"></div>
<div class="split3">
<a href="#">
<img src="http://i.imgur.com/ZooSwpU.png" title="source: imgur.com" />
</a>
</div>
<div class="split4">
<a href="#">
<img src="http://i.imgur.com/sMsHX14.png" title="source: imgur.com" />
</a>
</div>
</div>
You could use background images and assign them to the a tags. I have amended your codePen here > http://codepen.io/anon/pen/YPBwJX
However, it may be better to just use one image, and overlay transparent a-tags, set them to display block and then you don't have to worry about the image lining up! Anyways, please see the code below for the question asked =)
.splitWrapper {
width: 850px;
margin: auto;
}
a.split1 {
background: url('http://i.imgur.com/Jnah8Y0.png');
}
a.split2 {
background: url('http://i.imgur.com/mGftOCN.png');
}
a.split3 {
background: url('http://i.imgur.com/ZooSwpU.png');
}
a.split4 {
background: url('http://i.imgur.com/sMsHX14.png');
}
a.split{
width: 417px;
height: 300px;
float: left;
margin: 0;
padding: 0;
display: block;
background-size: 417px 300px;
}
.clear { clear: both; }
<div class="splitWrapper">
<div class="clear"></div>
</div>
I don't think you quite understand how % works in CSS. % means that percentage of the parent element. Also, for it to work, the parent element has to have a defined width. Here's the CSS changes you need:
.splitWrapper {
width: 100%;
}
.split, .split2, .split3, .split4 {
display: inline-block;
margin: -2px;
width: 25%;
}
.split img,
.split2 img,
.split3 img,
.split4 img {
max-width: 100%;
}
.spliter {
margin-top: -3px;
}
http://codepen.io/anon/pen/KwJVGQ
You'll need to adjust your margins accordingly. You should use percentage margins since you're working with percents. Just divide the width of the margin by the width of the element and multiply it by 100 to get your margin percentage.
So, I'm trying to make a chatbox, with the following:
<div class="text-container">
<div class="text" id="textholder">
<p>message</p>
...
<p>message</p>
</div>
</div>
<div class="chatbox-container">
<div class="chatbox">
<input type="text" id="textinput" class="inputText" placeholder="Enter text" />
<input type="submit" class="send" onclick="addMessage()" value="Send" autofocus />
</div>
</div>
With the following css:
.text-container{
width: 100%;
height: 500px;
overflow: auto;
position: relative;
}
.text{
position: absolute;
bottom: 0px;
left: 25%;
width: 50%;
height: auto;
}
.chatbox-container{
width: 100%;
height: 30px;
overflow: auto;
}
Where I add some more p's to with the addMessage() function (just adds paragraph with text to innnerHTML of #textholder)
now the problem is that I can't get the text div to overflow(auto), which means the text just disappears.
I want the text to be in the center of the text-container, but I want the scroll to be on the container, so it looks like in skype.
How can I do this? Also, I've tried to basicly align the messages to the bottom of the textbox in a skypelike manner, but I've read that this can also be done by vertical-aligning. yet this didn't work how I wanted it.
Hopefully you get what I'm asking, English is not my native language, and I'm not sure if I'm asking it in the right way.
thanks in advance!
ps. please take into account that this is part of a bigger page, thus I left out some parts.
Ammend your text class to :
.text{
position: absolute;
bottom: 0px;
height: 500px; //fix the height
width :90%;
overflow: auto; //scroll the content
}
Fiddle : http://jsfiddle.net/logintomyk/pETfX/
You have made the container overflow, while the messages are in text, so you need to overflow that class mate!! :)
Probably this is what you are looking for
.text-container {
height:200px;
overflow: auto;
border:1px solid #ccc;
}
.chatbox-container {
height: 30px;
}
jsfiddle
Javascript:
<script type="text/javascript">
$(function() { $('.cat_name').tipsy({gravity: 's'}); });
</script>
TPL Smarty:
<div id="content_inside">
<a href="#" title="Test" id="1" class="cat_name">
<div class="box">
</div>
</a>
<a href="#" title="Test2" id="2" class="cat_name">
<div class="box">
</div>
</a>
</div><!-- content end -->
CSS:
#content_inside {
height: 500px;
width: 950px;
padding:5px;
}
.box {
width: 300px;
height: 261px;
padding: 5px;
float: left;
}
.box {
margin: auto;
background: url(../images/box1.jpg) no-repeat top left;
}
I need to place tipsy in upper center of every div link, how to do that?, for now tipsy are shown always at left side. Example of how is, and how need to be in img: http://oi43.tinypic.com/adka3t.jpg
There is an offset options in tipsy, which offsets from the elements.
$('.cat_name').tipsy({gravity: 's', offset: 20 });
Unfortunately, your float: left is causing tipsy to calculate the offset incorrectly. Are you able to lay out your page any differently? As an example, the following boring old tables layout seems to replicate what you're looking for designwise, as well as having the tooltips show up where you want them.
HTML:
<div id="content_inside">
<table>
<tr>
<td class="box">lkjoijkj lj lkj oij oi</td>
<td class="box">lkjoijkj lj lkj oij oi</td>
</tr>
</table>
</div>
CSS:
#content_inside {
height: 500px;
width: 950px;
padding:5px;
}
.box {
width: 300px;
height: 261px;
padding: 5px;
}
a {
display:block;
height: 100%;
}