Why are images not showing until the window is resized? - image

I am utilizing the modal from Zurb Foundation and some Liquid. Running into a strange issue. Images in the modal are being rendered to the DOM, but only show up when the screen is resized either smaller or larger.
Here is the code I am working with (yes, some elements have in-line styles specified).
<div class="grid-x align-middle grid-margin-x grid-margin-y small-up-1 medium-up-2 large-up-3 padding text-center">
{% for item in this.items %}
<div data-open="wa-project-{{forloop.index}}" class="cell" style="background-image:url('{{item['Image1']}}?mode=max&height=270'); height: 270px; width: 340px; background-size:cover; background-position:center; background-color:#00577d; margin: 12px auto;">
<div class="grid-y" style="height:270px; width:100%; background-color:rgba(0,25,36,.5)">
<div class="cell auto"></div>
<div class="cell shrink padding">
<div><a class="color-white" alt="{{item['Name']}} link">{{item['Name']}}</a></div>
<hr style="width: 125px; margin: 20px auto 0 auto; border-top-color: #8dd535">
</div>
<div class="cell auto"></div>
</div>
</div>
<!-- Modal -->
<div class="reveal" id="wa-project-{{forloop.index}}" data-reveal data-animation-in="scale-in-up" data-overlay="true">
<div class="orbit" role="region" aria-label="GoMedia Projects" data-orbit>
<div class="orbit-controls">
<button class="orbit-previous"><span class="show-for-sr">Previous Slide</span>◀︎</button>
<button class="orbit-next"><span class="show-for-sr">Next Slide</span>▶︎</button>
</div>
<ul class="orbit-container">
{% if item.image1 != "" %}
<li class="orbit-slide is-active">
<figure class="orbit-figure">
<img class="orbit-image" src="{{item.image1}}?mode=max&width=600" alt="space">
</figure>
</li>
{% endif %}
{% if item.image2 != "" %}
<li class="orbit-slide">
<figure class="orbit-figure">
<img class="orbit-image" src="{{item['Image2']}}?mode=max&width=600" alt="Space">
</figure>
</li>
{% endif %}
{% if item.image3 != "" %}
<li class="orbit-slide">
<figure class="orbit-figure">
<img class="orbit-image" src="{{item['Image3']}}?mode=max&width=600" alt="Space">
</figure>
</li>
{% endif %}
{% if item.image4 != "" %}
<li class="orbit-slide">
<figure class="orbit-figure">
<img class="orbit-image" src="{{item['Image4']}}?mode=max&width=600" alt="Space">
</figure>
</li>
{% endif %}
</ul>
</div>
<h2 class="fontsize-30">{{item.name}}</h2>
<hr style="width: 100%; border-top-color: #8dd535">
<p>{{item.description}}</p>
<button class="close-button" data-close aria-label="Close modal" type="button">
<i class="fas fa-times-circle"></i>
</button>
</div>
{% endfor %}
</div>
I've been researching for a bit, but have not found an answer. A height and width is specified for the images in the CSS. I am seeing it happen across multiple browsers: Firefox, Chrome, Safari. I have even tried starting from scratch with the Zurb Foundation template for the modal to no avail.

Related

Last dropdown menu - Link sensitive area reduces when navbar stacked

I have this topbar
<div class="container topbar">
<nav class="navbar navbar-expand-sm ">
{{-- With d-none d-lg-block logo hides on screen smaller than lg
--}}
<div class="col-md-3 d-none d-lg-block">
<div id="contain-logo">
<div id="logo">
<a class="rounded" href="{{ url('/') }}">{{ config('app.name', '') }}</a>
</div>
</div>
</div>
<!-- with ml-auto item align on right Side Of Navbar -->
<ul class="navbar-nav ml-auto">
<!-- Authentication Links -->
#guest
<li class="nav-item">
<a class="nav-link" href="{{ route('login') }}">{{ 'Se connecter' }}</a>
</li>
#if (Route::has('register'))
<li class="nav-item">
<a class="nav-link" href="{{ route('register') }}">{{ 'Créer un compte' }}</a>
</li>
#endif
#else
#can('isAtLeastPhotoprovider')
<!-- Dropdown -->
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbardrop" data-toggle="dropdown">
Administration
</a>
<div class="dropdown-menu">
#can('isAtLeastWriter')
<a class="dropdown-item" href="{{ route('posts.index') }}">Articles</a>
#endcan
#can('isAtLeastManager')
<a class="dropdown-item" href="{{ route('infoletter.index') }}">Infoletters</a>
<a class="dropdown-item" href="{{ route('adherent.index') }}">Adhérents</a>
#endcan
#can('isAtLeastPhotoprovider')
<a class="dropdown-item" href="{{ route('filemanager.index') }}">Fournir des
photos(contraint)</a>
#endcan
#can('isAdmin')
<a class="dropdown-item" href="{{ route('upload.index') }}">Fournir des
photos(libre)</a>
#endcan
<a class="dropdown-item" href="{{ route('home') }}">Retour à l'accueil</a>
</div>
</li>
#endcan
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbardrop2" data-toggle="dropdown">
Bienvenue {{ Auth::user()->firstname }} {{ Auth::user()->familyname }} !
#can('isAtLeastPhotoprovider')
{{--Vous avez le rôle
{{ Auth::user()->role }}.--}}
#endcan
</a>
<div class="dropdown-menu ">
<a class="dropdown-item" href="{{ route('logout') }}" onclick="event.preventDefault();
document.getElementById('logout-form').submit();">
{{ 'Se déconnecter' }}
</a>
</div>
<form id="logout-form" action="{{ route('logout') }}" method="POST" class="d-none">
#csrf
</form>
</li>
#endguest
</ul>
</div>
</div>
</nav>
Hereafter are the changes in css that are in the custom css
.dropdown-menu {
background-color: antiquewhite;
padding: 5px;
}
.dropdown-item {
background-color: #513217;
border-radius: 8px;
color: antiquewhite;
margin-top: 5px;
}
.navbar {
background-color: transparent;
}
.navbar-nav {
background-color: transparent;
}
.nav-link {
color: antiquewhite;
background-color: rgba(110, 98, 89, 1);
border-radius: 5px;
border: 1px solid antiquewhite;
margin-left: 15px;
}
In this top bar there are 2 dropdown menus (Administration and Bienvenue). The trouble appears only when the navbar's dropdown menus become stacked on smaller devices.
The trouble appears only on the last dropdown menu. If Administration is the last it has the trouble and Bienvenue has not. Conversely if Bienvenue is the last it appears only for it.
The trouble is that the area where the mouse pointer has to be to trigger the link reduces to be a very thin strip on the top of the menu item. It is very uncomfortable for the user specially on smart phones.
In addition, the only item in the dropdown menu becomes effectless !
Thank you in advance for any help.
Finally I found that a div was overlapping the menu. Nothing very serious.

Jekyll - show images & text in slider

I am using Bootstrap-Carousel.
Unfortunately, the data from front-matter is not being rendered.
index.html:
...
carousel:
a:
image: home/athenaBeta.jpeg
text: random text 1
b:
image: home/transport.jpeg
text: |
random text 2
c:
image: home/coffee.jpeg
text: |
random text 3
---
{% include hero-carousel.html %}
...
hero-carousel.html:
<div id="carousel" class="carousel slide" data-ride="carousel" pause="false">
<div class="carousel-inner text-center">
{% for news in page.carousel %}
{% capture image %}
{% assign img = news.image %}
{% endcapture %}
<div class="item img-cover img-fixed {% if forloop.index == 0 %}active{% endif %}" style="background-image:url({{ image }})">
<h2>{{ news.text }}</h2>
</div>
{% capture i %}{{ i | plus:1 }}{% endcapture %}
{% endfor %}
</div>
<a class="left carousel-control" href="#carousel" role="button" data-slide="prev">
<span class="fa glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#carousel" role="button" data-slide="next">
<span class="fa glyphicon-chevron-right"></span>
</a>
<a class="arrow-down" href="#content">
<span class="fa glyphicon-chevron-down"></span>
</a>
</div>
It renders the three slides, however, none of the images or text is rendered. The output I get in browser is as below:
<div id="carousel" class="carousel slide" data-ride="carousel" pause="false">
<div class="carousel-inner text-center">
<div class="item img-cover img-fixed " style="background-image:url(
)">
<h2></h2>
</div>
<div class="item img-cover img-fixed " style="background-image:url(
)">
<h2></h2>
</div>
<div class="item img-cover img-fixed " style="background-image:url()">
<h2></h2>
</div>
</div>
<a class="left carousel-control" href="#carousel" role="button" data-slide="prev">
<span class="fa glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#carousel" role="button" data-slide="next">
<span class="fa glyphicon-chevron-right"></span>
</a>
<a class="arrow-down" href="#content">
<span class="fa glyphicon-chevron-down"></span>
</a>
</div>
When you loop in page.caroussel, you receive things like :
{{ news | inspect }}
==> ["a", {"image"=>"home/athenaBeta.jpeg", "text"=>"random text 1"}]
which is an array containing two elements.
In order to reach your image, you can do {% assign img = news[1].image %}, but you'd better refactor a little :
...
carousel:
- image: home/athenaBeta.jpeg
text: random text 1
- image: home/transport.jpeg
text: |
random text 2
- image: home/coffee.jpeg
text: |
random text 3
---
<div id="carousel" class="carousel slide" data-ride="carousel" pause="false">
<div class="carousel-inner text-center">
{% for news in page.carousel %}
<div class="item img-cover img-fixed {% if forloop.first %}active{% endif %}" style="background-image:url('{{ news.image }}')">
<h2>{{ news.text }}</h2>
</div>
{% endfor %}
</div>

Displaying an image over another image

I have a carousel showing images. Some of them are thumbs of youtube video in that case i want an image of a play button to be displayed over the thumb image to show that it is a video not a simple image.
<div class="carousel-inner">
#foreach($realisation->images as $key => $img)
#if($img->type == 'image')
<div class="item {{ $key == 0 ? 'active': '' }}">
#if(File::exists($img->image))
<img src="{{asset($img->image)}}" class="image" alt="realisation{{$img->id}}"/>
#endif
</div>
#else
<div class="item {{ $key == 0 ? 'active': '' }}">
<a href="{{$img->video}}" data-lity>
<img src="{{ LaravelVideoEmbed::getYoutubeThumbnail($img->video) }}" class="image" alt="realisation{{$img->id}}">
<img src="{{asset('img/icon-14-orange.png')}}" alt="">
</a>
</div>
#endif
#endforeach
</div>
change your code, add class for play image class="playOverlay":
.....
#else
<div class="item {{ $key == 0 ? 'active': '' }}">
<a href="{{$img->video}}" data-lity>
<img src="{{ LaravelVideoEmbed::getYoutubeThumbnail($img->video) }}" class="image" alt="realisation{{$img->id}}">
<img class="playOverlay" src="{{asset('img/icon-14-orange.png')}}" alt="">
</a>
</div>
#endif
.....
css:
.item{position:relative}
img.playOverlay{
position:absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}

Boostrap responsitive image is deform in carousel mode

I'm newbee in Boostrap and I try since 2 days to manage Boostrap carouseul mode.
My images in slide are Disproportionate when I resize navigator ! I was unable to find solution. I try many solution in CSS but I naver finnd solution.
I use default CSS parameter, present in carousel mode. I try carousel mode from w3schools (image are not corrupt when we resize navigator).
My CSS
/* Carousel base class */
.carousel {
height: 500px;
margin-bottom: 60px;
}
/* Since positioning the image, we need to help out the caption */
.carousel-caption {
z-index: 10;
}
/* Declare heights because of positioning of img element */
.carousel .item {
height: 500px;
background-color: #777;
}
.carousel-inner > .item > img {
position: absolute;
top: 0;
left: 0;
min-width: 100%;
height: 500px;
margin: auto;
}
My HTML
<!-- Carousel
================================================== -->
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="item active">
<img class="first-slide" src="media/image1.jpg" alt="">
<div class="container">
<div class="carousel-caption">
<h1>Secucampus.com</h1>
<p class="trans"> bla bla</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Plus d'informations</a></p>
</div>
</div>
</div>
<div class="item">
<img class="second-slide" src="media/image2.jpg" alt="">
<div class="container">
<div class="carousel-caption">
<h1>Secucampus.com</h1>
<p class="trans">bla bla</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Contactez nous</a></p>
</div>
</div>
</div>
<div class="item">
<img class="third-slide" src="media/image3.jpg" alt="">
<div class="container">
<div class="carousel-caption" style="text-align:left">
<h1>bla </h1>
<p></p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Contenu des cours</a></p>
</div>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div><!-- /.carousel -->
The result when I resize image to Smarphone mode :
Thank for your help
Regard
Edit : Banzay :
I try to remove it and the result decrease image in hignht when I reduce the width of the navigateur.

Get template block contents and call from ajax

I'm using django 1.9 and python 3. My english also isn't the best, so excuse the question if it is formulated bad.
I'm working on making my website a single-page application. I need to get the {% block %} contents of a given template, and then send that as a HttpResponse so that ajax can pick it up and inject it into the page.
I've tried using the answer from this question: Django - how to get the contents of a {% block %} tag from a template
But upon trying to fetch the contents of a block in my view like so:
response_data[content] = get_block_source('profile/login.html', 'content')
if request.is_ajax():
return HttpResponse(
json.dumps(response_data),
content_type="application/json"
)
I just get this error from django, no matter what I do:
ValueError at /login/ Template block content not found
The contents of the block don't even make it to the ajax call, what gives?
EDIT:
I'll include my "content" block here:
in my template:
{% extends 'base.html' %}
{% block content %}
<div class="big-title text">Log in</div>
<div class="form-container">
<form name="login-form" id="user" method="post" action="/login/" enctype="multipart/form-data" class="text">
{% csrf_token %}
<div class="title">Enter your credentials</div>
<div class="form-row">
<div class="form-flex">
<div class="field-container">
<div class="field-input-container">
<div class="field-label accent">Username</div>
<div class="field-input">
<input class="field-input-element" type="text" name="username" />
</div>
</div>
<div class="field-help">Your username is always lowercase.</div>
</div>
</div>
<div class="form-flex">
<div class="field-container" style="height: 110px">
<div class="field-input-container">
<div class="field-label accent">Password</div>
<div class="field-input">
<input class="field-input-element" type="password" name="password" />
</div>
</div>
<div class="field-help"></div>
</div>
</div>
</div>
<div class="form-button-container">
<div class="form-error"></div>
<div class="form-message"></div>
<input type="submit" name="submit" value="Accept" class="button form-button"/>
</div>
</form>
</div>
{% endblock %}
In my base (base.html)
<body>
<div id="modal-container">
<div id="modal-overlay">
<div id="modal-items">
</div>
</div>
</div>
<div id="wrapper">
<header>
<div id="header-title" class="text accent">App name</div>
<div id="header-nav">
<nav>
{% if user.is_authenticated %}
Home
Feed {% if request.user.is_superuser %}
Admin {% endif %}
N
<a href="/{{ request.user }}" class="header-avatar-small-a">
<div class="text header-greeting">Hi, {{ user.userprofile.display_name }}</div>
<div class="header-avatar-small">
{% if not user.userprofile.avatar == '' %}
<img src="{{ MEDIA_URL }}users/{{ user }}/avatar" alt=""> {% else %}
<img src="{{ MEDIA_URL }}users/avatar" alt=""> {% endif %}
</div>
</a>
{% else %}
Log in
Create account {% endif %}
</nav>
</div>
<div class="progress">
<div id="header-progress" class="fill"></div>
</div>
</header>
<main>
{% block content %} {% endblock %}
</main>
<footer></footer>
</div>
</body>
</html>
Template source is the template actual HTML, not the file reference

Resources