Skip to content

Instantly share code, notes, and snippets.

@lbvf50mobile
Created November 17, 2017 13:36
Show Gist options
  • Select an option

  • Save lbvf50mobile/5dc976a3a451ac491159ea6b5d971482 to your computer and use it in GitHub Desktop.

Select an option

Save lbvf50mobile/5dc976a3a451ac491159ea6b5d971482 to your computer and use it in GitHub Desktop.
flex ancestors error
main.pose .center{
background-color: white;
width: 320px - 43px; // Iphone 5
height: 662px;
display: flex;
flex-direction: column;
margin: auto;
margin-top: 28px;
border-radius: 3px;
position: relative;
& a.center{
flex: 1 100;
margin-top: 0px;
padding: 0px;
display: block;
width: auto;
height: auto;
max-width: 320px - 43px;
max-height: 370px;
}
& img{
// https://stackoverflow.com/questions/12991351/css-force-image-resize-and-keep-aspect-ratio
padding: 0px;
margin: 0px;
display: block;
width: auto;
height: auto;
max-width: 320px - 43px;;
max-height: 370px;
}
& .text{
flex: 100 1;
display: block;
border-top: 1px solid rgb(225,227,235);
padding-top: 15px;
padding-left: 25px;
@include regular;
font-size: 14px;
line-height: 27px;
}
}
// Iphone 6
@media (min-width: 374px) {
main.pose .center{
width: 371px - 43px;
height: 662px;
& a.center{
max-width: 371px - 43px;
max-height: 370px;
}
& img{
max-width: 371px - 43px;
max-height: 370px;
}
}
}
// Iphone 6+
@media (min-width: 413px) {
main.pose .center{
width: 371px;
height: 662px;
& a.center{
max-width: 371px;
max-height: 370px;
}
& img{
max-width: 371px;
max-height: 370px;
}
}
}
main.main{
overflow-y: auto;
flex: 1 1 auto;
background-color: rgb(244,245,249);
display: block;
&::-webkit-scrollbar-track
{
/*-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);*/
background-color:rgba(244, 245, 249, 1);
}
&::-webkit-scrollbar
{
width: 2px;
background-color:rgba(244, 245, 249, 1);
}
&::-webkit-scrollbar-thumb
{
background-color: #c5c6c9;
}
}
main.guide, main.profile, main.pose{
overflow-y: auto;
flex: 1 1 auto;
background-color: rgb(244,245,249);
padding-top: 11px;
padding-left: 11px;
padding-right: 0px;
display: block;
&::-webkit-scrollbar-track
{
/*-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);*/
background-color:rgba(244, 245, 249, 1);
}
&::-webkit-scrollbar
{
width: 2px;
background-color:rgba(244, 245, 249, 1);
}
&::-webkit-scrollbar-thumb
{
background-color: #c5c6c9;
}
& div.img, & img{
margin: 0px 5px 5px 0px;
}
& img{
width: 190px;
height: 190px;
}
& div.img{
display: inline-block;
padding: 0px;
vertical-align:top;
text-align: center;
background-size: cover;
background-position: center;
width: 190px; // Hard code for iPhone6+, latter rewrite by JS
height: 190px; // Hard code for iPhone6+, latter rewrite by JS
}
}
main.profile {
padding-top: 11px;
padding-left: 11px;
padding-right: 11px;
display: flex;
}
main.pose{
padding-top: 0px;
padding-left: 0px;
padding-right: 0px;
overflow-x: hidden;
}
.main > .set{
width: 100%;
background-color: white;
margin: 12px 0px;
padding: 25px 15px 12px 23px;
border-radius: 5px;
position: relative;
display: block;
.set-data{
@include light;
font-size: 18px;
color: $blue;
}
.set-amount{
@include light;
margin-top: 10px;
color: $gray;
font-size: 12px;
}
.set-images{
position: relative;
margin-top: 22px;
margin-bottom: 15px;
width: 100%;
img{
width: 32%;
}
.img{
display: inline-block;
padding: 0px;
vertical-align:top;
text-align: center;
background-size: cover;
width: 113px; // Hard code for iPhone6+, latter rewrite by JS
height: 75px; // Hard code for iPhone6+, latter rewrite by JS
}
.set-more{
display: inline-block;
padding: 0px;
vertical-align:top;
text-align: center;
background: rgb(162, 207, 248);
color: white;
background: linear-gradient(rgb(162, 207, 248), rgb(105, 161, 239));
width: 113px; // Hard code for iPhone6+, latter rewrite by JS
height: 75px; // Hard code for iPhone6+, latter rewrite by JS
}
}
}
{% extends "login/layout.html" %} {% block content %}
<header class="pose">
<a href='/login' class='btn-back'></a>
<h2>Pose</h2>
<span class="count">2/40</span>
</header>
<main class="pose">
<div class="swiper-container">
<!-- Additional required wrapper -->
<div class="swiper-wrapper">
<!-- Slides -->
{% for j in 1..15 %}
<div class="swiper-slide" id="swiper{{j}}{{j}}">
<div class="center">
<a href="#ceter_link" class="center">
<img src="/images/ratio-imgs/{{j}}.jpg">
</a>
<div class="text">
{{j}}
Lorem ipsum dolor sit amet, consectetur adipcising elit. Morbi faucibus sapien a est ultircies porta. Cras non faugait nunc,
sit amet ornare orci. integer facilisi lacus massa, vel finibus nisl interdum a. Praesent eu gravida
leo, eu accusan ligula.
</div>
</div>
</div>
{% endfor %}
</div>
<!-- If we need navigation buttons -->
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
</div>
</main>
<footer class="pose">
<nav>
<a href="#" class="home active"></a>
<a href="#" class="man"></a>
<a href="#" class="list"></a>
</nav>
</footer>
<script>
// Function that Fires on Slike change.
var onSlideChange = function(id){
console.log(id);
}
$(document).ready(function () {
mySwiper = new Swiper('.swiper-container', {
// Optional parameters
direction: 'horizontal',
loop: false,
initialSlide: 6,
// Navigation arrows
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
on:{
slideChange: function(){
var id = $(".swiper-slide").eq(this.activeIndex).attr('id');
if(id){
onSlideChange(id)
}
}
}
})
})
</script> {% endblock %}
1) On Desktop Chrome works fine: https://youtu.be/e6jIKx7KM7s
2) On Iphone dose not works: https://youtu.be/0Nw_dHPhYZQ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment