How to make a Bootstrap 3 Alert flyin from top of screen to center - twitter-bootstrap-3

I've been searching high and low for some examples of a Bootstrap 3 Alert box flying in from to top of screen and ending at center screen on top of all elements.
I'm finding lots re. modals, but how do i accomplish this behavior for a alert box?

You can take a look at this answer by chipChocolate.py, and the fiddle he provided here.
It is not exactly what you are looking for since the div is moving from bottom to top but the idea is the same.
Create three divs: main-container, alert-container, alert-content
<div class="main-container">
<div class="alert-container">
<!-- placeholder image -->
<img class="inner_img" src="http://placehold.it/1000x1000" />
<div class="alert-content">
<div class="alert alert-danger">
<strong>Danger!</strong> This alert box could indicate a dangerous or potentially negative action.
</div>
</div>
</div>
</div>
Then apply this css
.main-container{
position: relative; /* Set to absolute */
}
.alert-container {
position: absolute; /* Set to absolute and positioned at top corner*/
top: 0;
left: 0;
}
.alert-content {
position: absolute; /* This moves it to the bottom (initial state) */
bottom: 90%;
width: 100%;
height: 10%;
transition: bottom 1s;
}
.main-container:hover .alert-content {
bottom: 50%; /* This moves it to the middle (only on hover) */
}
i have made a fiddle here with bootstrap alerts and made the transition from top to the middle of the page. You can adjust it accordingly.

Related

Fixed navBar and sidebar overlap Semantic UI

I'm looking to maintain fixed navbar irregardless of sidebar with it appearing under the navbar as in here with attached top/bottom:
http://codepen.io/redshift7/pen/VaKmjq
<div class="ui bottom attached segment">
<div class="ui inverted labeled icon left inline vertical demo sidebar menu">
Attached segment won't work with fixed navbar where it will stretch through the page. I'd rather see the answer in vue.js.
You need to make following CSS changes for this to work:
.menu {
position: fixed;
top: 0px;
z-index: 10001;
width: 100%;
}
.pusher {
margin-top: 36px;
}
.pushable {
margin-top: 0px !important;
}
Working codepen: here

jssor carousel Having an Issue

I need simple horizontal no-autoplay carousel where images are of various width but same height (117px). I need to see continuous multiple images (depending on their width) in the container separated by, say, 5px. Much like oriental lady example on jssor.com.
What I get (see below code) is perfectly working carousel, BUT only displaying single image per slide. What do I need to do/set to get multiple images per slide please?
<script src="../js/jquery-1.9.1.min.js"></script>
<script src="../js/jssor.slider.min.js"></script>
<script>
jQuery(document).ready(function (\$) {
var options = {
\$AutoPlay: false,
\$Loop: 0,
};
var jssor_slider2 = new \$JssorSlider\$('slider2_container', options);
});
</script>
<div id="slider2_container" style="position: relative; top: 0px; left: 0px; width: 300; height: 117;">
<!-- Slides Container -->
<div u="slides" style="cursor: move; position: relative; overflow: hidden; left: 0px; top: 0px; width:300; height: 117">
<div>
<img src="$imgpath/msummer2015.jpg">
<p>Marklin Summer 2015</p>
</div>
<div>
<img src="$imgpath/m2015.jpg">
<p>Marklin 2015</p>
</div>
<div>
<img src="$imgpath/roco2015.jpg">
<p>Roco 2015</p>
</div>
<div>
<img src="$`enter code here`imgpath/fl2015.jpg">
<p>Fleischmann 2015</p>
</div>
</div>
</div>
First of all, please define your slider size in pixel (300px, 117px).
Note that every slide should be in fixed size.
Given a slider in size 300 x 117, you can display 2 or more slides in the slides container. Please set $SlideWidth, $DisplayPieces, $SlideSpacing options.
var options = {
$AutoPlay: false,
$Loop: 0,
$SlideWidth: 150,
$DisplayPieces: 2, //or more if you like
$SlideSpacing: 0
};

Prestashop header add icons/links not clickable

I need some help with header icons. I add icons near logo, and i want to make them with link, but they are not working.I can click on logo, but I can't click on them.
Here is the part of code:
<a id="header_logo" href="{$base_dir}" title="{$shop_name|escape:'htmlall':'UTF-8'}">
<img class="logo" style="margin-bottom:10px;" src="https://www.irankiuparduotuve.lt/img/irankiu-parduotuve.png" alt="{$shop_name|escape:'htmlall':'UTF-8'}" />
</a>
<a href="https://www.irankiuparduotuve.lt/info/kaip-pirkti/#4">
<img style="margin-bottom:10px; position: absolute; top: 13%; left: 23%;" src="https://www.irankiuparduotuve.lt/img/saugu.png" alt="Saugu pirkti!" />
</a>
<a href="https://www.irankiuparduotuve.lt/info/kaip-pirkti/#7">
<img style="margin-bottom:10px; position: absolute; top: 13%; left: 31%;" src="https://www.irankiuparduotuve.lt/img/pristatymas.png" alt="Pristatymas visoje Lietuvoje!" />
</a>
And this is how it looks like on website
it's probably cause by poorly written CSS rules. Your logos are positioned using position:absolute;,which is causing all the trouble. The anchor element <a> is positioned statically, meanwhile the image inside is position:absolute;. Therefore, the anchor element doesnt have any height or width and is unclickble.
What you can do is edit the CSS rules for anchor and image tags:
<a href="https://www.irankiuparduotuve.lt/info/kaip-pirkti/#7" style="
z-index: 11; margin-bottom: 10px;
position: absolute; top: 13%;
left: 31%; display: inline-block;">
<img style="/* margin-bottom:10px; */ /* position: absolute; */
/* top: 13%; */ /* left: 31%; */
/* display: inline-block; */"
src="https://www.irankiuparduotuve.lt/img/pristatymas.png">
</a>
Sorry for poor formatting. Basically you need to apply yout positionin rules to <a> element, not the <img>
Sėkmės!

bootstrap place footer at bottom if content has smaller height then window

I want to place the footer at bottom of the window if the content of window has no scrollbars otherwise put the footer at the end of content
here is my html code
<div class="container-fluid">
<div class="header"></div>
<div class="con"></div>
<div class="footer">Copyright msg</div>
</div>
The effect you are looking for is known as a 'sticky footer', I believe -- where the footer will always appear pinned to the bottom of the page, even if the content is very short? You can find the solution here.
.footer {
position: fixed;
bottom: 0;
right: 0;
left: 0;
}

JQuery-Mobile content area 100% height between head and foot

A lot of topics on this... but not getting the point how to do it.
I have my JQM Header and Footer. I want the content area to fill the 100% height in between head and foot.
Thats my code, how is it possible?
<body>
<div data-role="page" id="entryPage" data-theme="d">
<div data-role="header" id="header" data-position="fixed" data-theme="d">
<h1>Page Title</h1>
</div><!-- /header -->
<div data-role="content" id="content" data-theme="d">
<div id="columnwrapper">
<div id="leftcolumn">
<div class="innertube">
Point 1
</div>
<div class="innertube">
Point 1
</div>
</div>
</div>
<div id="rightcolumn">
<div class="innertube">
<div id="switch1">
test
</div>
</div>
<div class="innertube">
test2
</div>
</div>
<div id="contentcolumn">
<div class="innertube">Content</div>
<div class="innertube">Content</div>
</div>
</div><!-- /content -->
<div data-role="footer" id="footer" data-position="fixed" data-theme="d">
<div id="switch2">
Expand main menu
</div>
</div><!-- /footer -->
</div><!-- /page -->
</body>
CSS:
#columnwrapper{
float: left;
width: 100%;
margin-left: -75%; /*Set left margin to -(contentcolumnWidth)*/
background-color: #C8FC98;
}
#leftcolumn{
margin: 0 40px 0 75%; /*Set margin to 0 (rightcolumnWidth) 0 (contentcolumnWidth)*/
background: #C8FC98;
}
#rightcolumn{
float: left;
width: 40px; /*Width of right column*/
margin-left: -40px; /*Set left margin to -(RightColumnWidth)*/
background: yellowgreen;
}
#contentcolumn{
float: left;
width: 75%; /*Width of content column*/
background-color: blue;
}
.innertube{
margin: 0px; /*Margins for inner DIV inside each column (to provide padding)*/
margin-top: 0;
}
Actually the inner area only fills the height depending on the content... means 2 divs 2 rows, but not 100%..
Thanks
The CSS position: fixed doesn't work correctly in mobile browsers. My experience is with Android and iOS browsers and none of them impliment position: fixed properly (the exception is the iOS 5 browser but it's still in beta).
Rather than fixing an element to the screen and not moving it when the user scrolls in mobile browsers it tends to be treated like position: absolute and it moves when the page scrolls.
Also using the CSS overflow property won't allow scrolling on most mobile devices (iOS supports it but the user has to know to use two fingers while scrolling in a scrollable-div).
You can however use CSS but be aware you will need to use position: absolute or you can use JavaScript to set the heights on the elements.
Here is a jQuery Mobile solution using JavaScript to set the heights of the pseudo-page elements:
$(document).delegate('#page_name', 'pageshow', function () {
var the_height = ($(window).height() - $(this).find('[data-role="header"]').height() - $(this).find('[data-role="footer"]').height());
$(this).height($(window).height()).find('[data-role="content"]').height(the_height);
});
To get a flawless finish you need to take into consideration the behavior of the target device's address bar because if you want a fullscreen webpage then you have to add the height of the address bar to the height of the page.
Thanks, Jasper! That helped me a lot.
I had to mess around a lot to get this to work with multiple headers/footers, and to account for the url bar in ios. I thought I would share my solution for any one else having this issue.
This is working for me so far in ios simulator, but I would be eager to hear how it works on other devices.
/* detect device */
var ua = navigator.userAgent,
iphone = ~ua.indexOf('iPhone') || ~ua.indexOf('iPod'),
ipad = ~ua.indexOf('iPad'),
ios = iphone || ipad,
android = ~ua.indexOf('Android');
$(document).delegate('#the_page', 'pageshow', function () {
var $page = $(this),
$target = $(this).find('.fullHeight'),
t_padding = parseInt($target.css('padding-top'))
+ parseInt($target.css('padding-bottom')),
w_height = (ios)? screen.height-65: $(window).height(); // "-65" is to compensate for url bar. Any better ideas?
headFootHeight = 0;
// Get total height for all headers and footers on page
$page.find('[data-role="footer"], [data-role="header"]').each(function() {
var myTotalHeight = $(this).height()
+ parseInt( $(this).css('padding-top') )
+ parseInt( $(this).css('padding-bottom') );
headFootHeight += myTotalHeight;
});
var the_height = (w_height - headFootHeight);
$page
.height(w_height)
.find('.fullHeight')
.height(the_height - t_padding);
});
This script is setting a 100% height on '.fullHeight', instead of [data-role=content] to give more flexibility, but you can just add the fullHeight class to your [data-role=content] element.
One issue I'm still having is compensating for the url bar in ios, and finding a window height that works across devices. Any ideas on that?
the CSS:
footer {
display: block;
position: fixed;
left: 0;
bottom: 0;
right: 0;
height: 50px;
background-color: #333;
overflow: hidden;
z-index:1000;
-webkit-transform: translateZ(0);
opacity:.9;
}
header{
display:block;
position: fixed;
left:0;
right:0;
top:0;
height:50px;
overflow: hidden;
}
section{
display:block;
position:fixed;
left:0;
top:50px;
bottom:50px;
right:0;
overflow-y: auto;
}
nav{
display:block;
height:100%;
-webkit-backface-visibility: hidden;
}
.body{
overflow-y: hidden;
}
.bar {
border: 1px solid #2A2A2A;
background: #111111;
color: #ffffff;
font-weight: bold;
text-shadow: 0 -1px 1px #000000;
background-image: -webkit-gradient(linear, left top, left bottom, from(#3c3c3c), to(#111)); /* Saf4+, Chrome */
background-image: -webkit-linear-gradient(top, #3c3c3c, #111); /* Chrome 10+, Saf5.1+ */
background-image: -moz-linear-gradient(top, #3c3c3c, #111); /* FF3.6 */
background-image: -ms-linear-gradient(top, #3c3c3c, #111); /* IE10 */
background-image: -o-linear-gradient(top, #3c3c3c, #111); /* Opera 11.10+ */
background-image: linear-gradient(top, #3c3c3c, #111);
}
the only html needed:
<header class="bar" id="AllHead"></header>
<div data-role="content" class="content" id="home"><section><nav></nav></section></div><!-- /content -->
<footer class="bar" id="allFoot"></footer>
</div><!-- /page -->
you can then set whatever items you want inside the footer and the bottom nav bar
this will always look right, no matter what happens, also this wont flash on and off everytime you touch something. hope it helps