Show multiple column on AMP carousel - carousel

From what I've learned about <amp-carousel> it has only 2 types of carousel interface: carousel and slides, which you can see on the AMP example website. I need to create something like this, multiple columned carousel. Is AMP carousel able to achieve this?

You can't customize amp-carousel the way you want, you need to check out amp-base-carousel which allows you to set visible-count, advance-count and other useful properties.
The documentation.
Example :
<amp-base-carousel
loop="true"
height="450"
layout="fixed-height"
visible-count="(min-width: 1150px) 3, (min-width: 700px) 2, 1"
advance-count="(min-width: 1150px) 3, (min-width: 700px) 2, 1"
>
<div>slide1</div>
<div>slide2</div>
<div>slide3</div>
<div>slide4</div>
<button slot="next-arrow" class="carousel-next" aria-label="Next">
<i class="fas fa-chevron-circle-right"></i>
</button>
<button slot="prev-arrow" class="carousel-prev" aria-label="Previous">
<i class="fas fa-chevron-circle-left"></i>
</button>
</amp-base-carousel>
With some style for the buttons :
.carousel-prev, .carousel-next {
filter: drop-shadow(0px 1px 2px #4a4a4a);
width: 40px;
height: 40px;
padding: 20px;
background-color: transparent;
border: none;
outline: none;
font-size: 24px;
opacity:0.7;
}

In a way, yes.
You can use the slide interface, in under each section, but 4 entries.
<amp-carousel height="300" layout="fixed-height" type="slides">
<div>
<div class="blue-box"> 1 </div>
<div class="red-box"> 2 </div>
<div class="green-box"> 3 </div>
<div class="yellow-box"> 4 </div>
</div>
<div>
<div class="blue-box"> 9 </div>
<div class="red-box"> 8 </div>
<div class="green-box"> 7 </div>
<div class="yellow-box"> 6 </div>
</div>
</amp-carousel>
I understand it won't be shifting with one entry at a time, but I suppose it would be near to what you want

Related

Multi-line add-on for textarea

I'm using bootstrap 4 input-group and appending or pretending my inputs with add-ons as labels.
For the inputs its looking good. Now I need a multi-line add-on or label for text area.
I'm looking for best possible solution in Bootstrap or CSS.
Here is the code I'm trying.
<style>
.h-unset {
height: unset !important;
}
.multiline-label {
display: inline-block;
word-wrap: break-word;
word-break: break-word;
width: 100%;
}
</style>
<div class="input-group input-group-sm mb-3 row mx-0">
<div class="input-group-prepend col-md-3 px-0">
<label for="naastVastgoedbeleg-ging"
class="input-group-text w-100 rounded-0 multiline-label h-unset"
id="label-naastVastgoedbeleg-ging">
<strong>Werkzaamheden naast vastgoedbeleg-ging (bijv. loondienst of onderneming)</strong>
</label>
</div>
<textarea id="naastVastgoedbeleg-ging"
class="form-control rounded-0 col-md-9 h-unset"
aria-label="naastVastgoedbeleg-ging"
aria-describedby="label-naastVastgoedbeleg-ging">
</textarea>
</div>
Thankx for helping Happy Coding!
It worked by using this css
.multiline-label strong {
white-space: pre-wrap;
}

How do I center an element on large display using materialize?

I am using Materialize CSS and I'm trying to center a div. I'm trying to get the white boxes to center on mobile and desktop to the center of the page. All the white boxes are in the same div called root.
index.html
<body>
<div class="container">
<div id="mainContent" class="row">
<div id="root" class="col s12 xl l6"></div>
</div>
</div>
</body>
styles.css
#mainContent {
background-color: blue;
margin: auto;
display: block;
}
#root {
margin: 0 auto;
position: relative;
}
On mobile, it centers the white boxes correctly.
On desktop the boxes are on the left side.
If I add margin-left to .root{} then it's not centered on the mobile version.
I think the best way is to use grid offsets on the columns:
<body>
<div class="container">
<div id="mainContent" class="row">
<div class="col s12 l6 offset-l3"></div>
</div>
</div>
</body>
Adding the class offset-l3 will add an offset of 3 columns on the left for screen sizes l and xl. With 12 total columns and the content being 6 columns an offset of 3 will result in the content being centered.
The style.css can be updated to only set the background-color:
#mainContent {
background-color: blue;
}
I added a wrapper to index.html like so
<div id="mainContent" class="row">
<div class="valign-wrapper">
<div id="root" class="col s12 xl l6"></div>
</div>
</div>
Now the white boxes are centered in the middle on both smaller resoultion displays and bigger.

Safari flex-box

Trying to make responsive layout for my app with flexbox.
Flexbox working incorrect at safari.
When direction is row, all working right.
But for column layout broken. Having not idea why.
Already tried changing prefixes.(not autoprefix problem)
At chrome: gif
At safari: gif
sass:
$right-section-color: #98ee99
$left-section-color: fade_out(grey,0.8)
$font-color: fade_out(black,0.3)
.AllSection
width: 100%
color: $font-color
.Banner
#extend .BannerSection
.section
display: flex
justify-content: center
flex-direction: row
span
margin: auto
padding: 0
flex: 1
.imageWithText
flex: 1
margin: auto
display: flex
flex-direction: column
text-align: center
img
max-width: 10em
height: 100%
width: 100%
margin: auto
.text
flex: 1
margin: auto
#for $i from 1 through 5
#if($i % 2 == 0)
.section:nth-child(#{$i})
background-color: $left-section-color
#media #{$small-and-down}
flex-direction: column
#else
.section:nth-child(#{$i})
background-color: $right-section-color
#media #{$small-and-down}
flex-direction: column-reverse
jsx:
<Element name="AllSection" className="AllSection">
<div className="Banner">
<h3>Диспоузер Status це</h3>
</div>
<div className="section">
<div className="imageWithText">
<img src={ecoLogo} id='ecoLogo' alt="eco logo" />
<span>Екологічно</span>
</div>
<div className="text">
<span>Використання подрібнювача скорочує обсяг перевезеного на звалища сміття. Крім того, харчові
відходи є сировиною для виробництва біогазу. </span>
</div>
</div>
<div className="section">
<div className="text">
<span>Подрібнювачі миттєво усувають харчові відходи c кухні. Тепер не потрібно зберігати їх в сміттєвому відрі - джерелі неприємних запахів і бактерій.</span>
</div>
<div className="imageWithText">
<img src={wastedFood} alt="wasted food" />
<span>Гігієнічно</span>
</div>
</div>
<div className="section">
<div className="imageWithText">
<img src={kitchenPicture} alt="kitchen washer" />
<span>Практично</span>
</div>
<div className="text">
<span>Подрібнювач акуратно і легко встановлюється під раковину і не вимагає додаткових площ на
кухні. </span>
</div>
</div>
<div className="section">
<div className="text">
<span>Подрібнювач абсолютно безпечний для дітей і дорослих. Всередині немає ножів і шнеків.
Додаткову електробезпеку забезпечує пневмовимикач. </span>
</div>
<div className="imageWithText">
<img src={safetyIcon} alt="wasted food" />
<span>Безпечно</span>
</div>
</div>
</Element>
App created by react-create-app, so i have autoprefixer.
How can I fix this layout in safari?
UPDATE:
When setting width to 50% of element i want to layout, all working.
But how can i make it with flex: 1?

Bootstrap tooltip opens and closes repeatedly

I have a bootstrap tooltip which I have custom styled. There seems to be an issue with it. Whenever we hover over it, it opens and then immediately closes.
HTML -
<div class="container" style="padding-top:300px">
<div class="row">
<div class="col-md-12">
<span>A bunch of random text</span><span class="info-circle" data-html="true" title="" data-original-title="Tooltip Text">i</span>
</div>
</div>
<div class="row">
<div class="col-md-12">
<span>A bunch of random text</span><span class="info-circle" data-html="true" title="" data-original-title="Tooltip Text">i</span>
</div>
</div>
Here's an inline link to jsFiddle
UPDATED
I made a few changes. Try this: https://jsfiddle.net/2h7jbt9n/6/
HTML
<div class="container" style="padding-top:30px">
<div class="row">
<div class="col-md-12">
<span>A bunch of random text</span><span class="info-circle" title="YoHo Ho Ho" data-placement="top" data-toggle="tooltip">i</span>
</div>
</div>
<div class="row">
<div class="col-md-12">
<span>A bunch of random text</span><span class="info-circle" title="YoHo Ho Ho" data-placement="top" data-toggle="tooltip">i</span>
</div>
</div>
JS
$(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip({
container: '.info-circle'
});
});
The issue was with padding for the info-circle. I wrapped it in a container. It doesn't flicker now.
Hope it helps.
You are no longer using the tooltip-arrow as the visual arrow you are using the :before and :after after as the visual arrow. The problem is that you have made the arrow bigger and made your own triangles. When you make your css arrow you are using borders. You have set your top border colors to white and blue to make it seem like the arrow has a border as well. In doing this you have forgotten that your arrow still has a bottom transparent border and this transparent border is covering up the element that you are hovering over to deploy the tooltip. So set your :before and :after psuedo elements for your .tooltip-arrow to have a bottom border of none. Like so:
.tooltip.top .tooltip-arrow:after {
content: " ";
position: absolute;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
left: -17px;
top: -5px;
border-width: 12px;
border-top-color: #003f6e;
border-bottom:none;
}
.tooltip.top .tooltip-arrow:before {
content: " ";
position: absolute;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
left: -15px;
top: -5px;
border-width: 10px 10px 0;
border-top-color: #fff;
border-bottom:none;
z-index: 1;
}

Bootply: offcanvas row hight 100%

I'm trying to use the offcanvas row to create a slide-in side menu for a mobile device.
I would like the menu to have a fixed position so that it will occupy the entire length of the screen in both small and larger screens. It's a bit tricky to play with position:fixed because the whole structure seems to fall apart when I do so. I use the following structure
<div class="container">
<div class="row row-offcanvas row-offcanvas-left">
<!-- sidebar -->
<div class="col-sm-3 col-lg-2 col-xs-6 sidebar-offcanvas" id="sidebar" role="navigation">
<!-- menu left content -->
</div>
<!-- main right col -->
<div class="col-sm-9 col-lg-10 col-xs-12" id="main">
<div class="navbar navbar-inverse navbar-main navbar-static-top collapse-group" role="navigation" id="mobile-main-nav">
<div class="collapse in no-ani">
<div class="nav-buttons">
<button type="button" class="btn btn-success icn-only visible-xs pull-left offcanvas-toggle" data-toggle="offcanvas"><i class="icon-th"></i></button>
<!--- top menu content --->
</div>
</div>
</div>
<div class="row navbar-top-padding">
<div class="col-md-12 page" id="col3">
<!--- main content --->
</div>
</div>
</div>
</div>
</div>
With the following LESS styles
#media screen and (max-width: #screen-xs-max) {
/*
* Off Canvas
* --------------------------------------------------
*/
.row-offcanvas {
position: relative;
-webkit-transition: all .2s ease-out;
-moz-transition: all .2s ease-out;
transition: all .2s ease-out;
left:0;//necessary to make the animation work
}
.row-offcanvas-right .sidebar-offcanvas {
right: -87%; /* 6 columns */
}
.row-offcanvas-left .sidebar-offcanvas {
left: -87%; /* 6 columns */
}
.row-offcanvas-right.active {
right: 87%; /* 6 columns */
}
.row-offcanvas-left.active {
left: 87%; /* 6 columns */
}
.sidebar-offcanvas {
position: absolute;
top: 0;
width: 87%; /* 6 columns */
}
}