I have this liquid code:
<a href="{{ section.settings.button_link }}" class="btn--rounded">
{% include 'icon-btn--rounded' %}
<div class="link-label">{{ section.settings.button_label }}</div>
</a>
And when the button is hover, I need to show a different icon, for example:
{% include 'icon-btn--white' %}
I now that I can use display: none for that, but how can I dynamically change between buttons when I hover?
You have to use CSS to show the different icons on hover.
Liquid is a language that loads before the DOM is ready. This means that once you see content of the page the liquid code has finished its execution and it will not fire again until a reload of the page.
Or to say it in developer terms - you are trying to load a back-end function via the front-end, which is a big "no-no".
CSS and JS can't interact with liquid, but liquid can interact with them. Or to say it more simply you can create javascript and css code using Liquid, but you can't create liquid code using JS and CSS.
In addition includes are deprecated and you should be using render instead.
Here is the code that you should use:
<a href="{{ section.settings.button_link }}" class="btn--rounded">
<div class="icon">
{% render 'icon-btn--rounded' %}
</div><!-- /.icon -->
<div class="icon icon--hover">
{% render 'icon-btn--white' %}
</div><!-- /.icon -->
<div class="link-label">{{ section.settings.button_label }}</div>
</a>
<style>
.icon--hover {
display: none;
}
.btn--rounded:hover .icon {
display: none;
}
.btn--rounded:hover .icon--hover {
display: block;
}
</style>
I am new to Programming in general. Hence this 'repeated question' as I don't understand the answers given on other posts. (Just incase, I have tried command-shift-R, but it won't work. It just displays a grey screen. I would genuinely appreciate if you guys could direct me towards the right way as I've spent a good whole day trying to figure out why my main.css file won't update the webpage. Everything else is working. Apart from when trying to update the stylesheet of the webpage.
My project is to create a website through Flask. I have created my necessary #app.route(...)'s.
I am importing the following on my app.py file: from flask import Flask, render_template, url_for. Everything within my app.py file and templates folder works. The output of a basic webpage with a few bullet points and header is displayed.
My templates folder which includes layout.html consists of the following code:
`
<!--Stylesheet is linking to main.css file within static folder.
'url_for' function is taking care to find the exact location.-->
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/main.css') }}">
<!--The following 'if' statement determine what is displayed on the browser Tab.
The Default title is 'Intellectus' which is in the 'else'.-->
{% if title %}
<title>Intellectus - {{ title }}</title>
{% else %}
<title>Intellectus</title>
{% endif %}
</head>
<body>
<!--Top Navigation Bar-->
<!--Intellectus text-Homepage-->
<nav class="navbar-full">
<div class="navbar">
<ul class="nav navbar-nav"></ul>
<a class="navbar-brand" href="#">Intellectus</a>
<li class="active">User Profile</li>
<li><span class="sign-up"></span> Sign Up</li>
<li><span class="log-in"></span> Login</li>
</ul>
</div>
</nav>
<div class="container">
{% block content %}{% endblock %}
</div>
</body>
</html>`
My static folder includes a css folder which includes a main.css folder. It's basic stuff for now just to get something working. The code within main.css is below:
.navbar-full {
background-color: #00BFFF;
overflow: hidden;
}
.container-fluid a {
float: left;
color: #00BFFF;
text-align: center;
padding-top: 0px;
text-decoration: none;
font-size: 17px;
}
.container-fluid a:hover {
background-color: #f2f2f2;
color: forestgreen;
}
.body {
background-color: fuchsia;
}
Found the problem. I was using Safari browser instead of Chrome. Worked like a charm in Chrome.
Not sure what exactly was causing the problem with the Safari browser.
In django easy to generate an iterated list of titles from context received by template:
{% for instance in object_list %}
<li>{{instance.international_title}} </li>
{% endfor %}
And in css easy to create a popup overlay:
#overlay
{
height:300px;
width:300px;
margin:0 auto;
position:relative;
z-index:10;
display:none;
border:5px solid #cccccc;
border-radius:10px;
}
<div align="center">
Click Title for Detail
</div>
<div id="overlay">
<p> Here is the text giving more detail<p>
</div>
Would like to be able to associate a unique text with each unique title {{instance.international_short_description}} for the purposes of the overlay popup. However do not see how to do this. Is it necessary to somehow create a series of css classes: #overlay1, #overlay2 with custom href to each one? Is it possible to use a single class, pass a variable to it and then select the correct text? Have not been able to find examples.
You can alter the id, for example by adding the primary key of the instance, like:
{% for instance in object_list %}
<div align="center">
{{ instance.international_title }}
</div>
<div id="overlay{{ instance.pk }}">
<p>{{ instance.international_short_description }}<p>
</div>
{% endfor %}
I'm currently designing a new website and I added a dropdown which works perfectly fine when clicked. I basically want it to show that dropdown when hovered.
What I tried was:
{% include 'currency-picker' %}
<style>
.currency-picker {
background-color: transparent;
font-size: 12pt;
font:Montserrat;
letter-spacing: 2px;
color: black;
}
.currency-picker:hover {
display: block;
}
.currency-picker:hover {
background-color: white;
This is the dropdown itself:
<label class="currency-picker__wrapper">
<span class="currency-picker__label"></span>
<select class="currency-picker" name="currencies" style="display: inline; width: auto; vertical-align: inherit;">
{% assign codes = 'USD,EUR,GBP,CAD,ARS,AUD,BBD,BDT,BSD,BHD,BRL,BOB,BND,BGN,ILS,MMK,KYD,CLP,CNY,COP,CRC,HRK,CZK,DKK,DOP,XCD,EGP,XPF,FJD,GHS,GTQ,GYD,GEL,HKD,HUF,ISK,INR,IDR,NIS,JMD,JPY,JOD,KZT,KES,KWD,LVL,LTL,MXN,MYR,MUR,MDL,MAD,MNT,MZN,ANG,NZD,NGN,NOK,OMR,PKR,PYG,PEN,PHP,PLN,QAR,RON,RUB,SAR,RSD,SCR,SGD,SYP,ZAR,KRW,LKR,SEK,CHF,TWD,THB,TZS,TTD,TRY,UAH,AED,UYU,VEB,VND,ZMK' | split: ',' %}
{% assign supported_codes = settings.supported_currencies | split: ' ' %}
<option value="{{ shop.currency }}" selected="selected">{{ shop.currency }}</option>
{% for code in supported_codes %}
{% if code != shop.currency and codes contains code %}
<option value="{{ code }}">{{ code }}</option>
{% endif %}
{% endfor %}
</select>
</label>
The strange thing is, that the .currency-picker:hover {
background-color: white; works and it does indeed show the white background when hovered.
Is there anyone knowing a solutions of my problem?
Have a nice day and best regards,
Ismael
After looking at your code, is there any reason why you don't just use the same markup as the other dropdowns? Consistency is always key.
What you are trying to do does not work or is not allowed in the browser. Instead of using an actual "select" box, I would use the actual markup they are using on the other dropdowns which give you the exact functionality that you are looking for.
This code (taken from your site) should give you a clue on how to handle this. Also You ave an extra starting script tag on your page where you dropped that new test code..
Please note I changed the below code a bit to give you better reference. If you were to drop this code into your site, it would work, but you need to refactor it to make it dynamic.
<li class="site-nav__item site-nav__expanded-item site-nav--has-dropdown" aria-haspopup="true">
USD <span class="icon icon-arrow-down" aria-hidden="true"></span>
<ul class="site-nav__dropdown text-left">
<li>
EUR
</li>
<li>
CHF
</li>
</ul>
After my change...
I have a custom theme that I did not make, I was wondering if there was anyway to make it so I can hide menu items (so they don't show up on the menu bar). Maybe something in the stylesheet to dictate it? Please help!
<div id="store" class="clearfix">
<div id="header">
<h2 id="logo" {% if theme.image != blank %}class="image"{% endif %}>{% if theme.image != blank %}<img height="35"src="{{ theme.image.url }}" />{% endif %}</h2>
<div id="top-pages">
<ul>
<li>{{ pages.home | link_to }}</li>{% for page in pages.all %}<li>{{ page | link_to }}</li>{% endfor %}<li>{{ pages.contact | link_to }}</li>
</ul>
</div>
<!-- #top-pages -->
Can't tell you what to hide without you posting some of the code on here but why don't you just 'display: none;' the menu li?
*menu-item* {display: none;} //where menu item is the path to the menu item