Skip to content

Instantly share code, notes, and snippets.

View ankedsgn's full-sized avatar

Anke ankedsgn

  • Flink
View GitHub Profile
figure.ratio-box {
height: 0;
position: relative;
background: var(--lightGrey);
padding-top: 100%; //default. Correct padding is calculated and set inline in the module
img {
position: absolute;
top: 0;
}
{# Global svg icons 'use' method see: http://css-tricks.com/svg-sprites-use-better-icon-fonts/ also: http://ianfeather.co.uk/ten-reasons-we-switched-from-an-icon-font-to-svg/
<svg class="icon icon-folder">
<use xlink:href="#icon-folder"></use>
</svg>
#}
{% spaceless %}
<svg display="none" xmlns="http://www.w3.org/2000/svg">
@ankedsgn
ankedsgn / Get values from select in contenttypes.yml
Created July 13, 2020 13:26
Get values from select in contenttypes.yml
{% set wijken = app.config.get('contenttypes/zoekmachine/fields/wijk_toenjoy/values') %}
<select name="wijken">
{% for item, key in wijken %}
<option value="{{item}}">{{ key }}</option>
{% endfor %}
</select>
@ankedsgn
ankedsgn / ogimage - config.yml
Created June 2, 2020 13:40
OGimage for SEO extension Bolt
# place below in the seo.bobdenotter.yml
fields:
title: ['title', 'name']
description: ['introduction', 'teaser', 'description', 'body']
keywords: []
# prefer the OGimage field over the organic image field
image: ['ogimage','image']
@ankedsgn
ankedsgn / faq.js
Created May 20, 2020 13:21
FAQ met openklappers en fade in
jQuery(function ($) {
// faq
$('.faq-question').on('click', function(e){
e.preventDefault();
var thisfaq = $(this).parent('.faq-set');
var faqQ = $(this);
var faqA = $(this).next('.faq-answer');
@ankedsgn
ankedsgn / custom.js
Created May 12, 2020 11:47
Inline ckeditor images
//Better inline images from the wysiwyg editor
if ($('.user-content img[style]').length > 0){
var inlineimg = $('.user-content img[style]');
console.log(inlineimg);
inlineimg.css("width","").css("height","");
}
@ankedsgn
ankedsgn / scroll to right anchors.scss
Created March 24, 2020 10:23
Scroll to anchors with fixed headers
h2 a[name] { // all anchors
scroll-margin-top: 70px;
@supports (-webkit-overflow-scrolling: touch) { // bc ios safari is not playing along
/* CSS specific to iOS devices only */
padding-top: 70px;
margin-top: -70px;
}
}
@ankedsgn
ankedsgn / app.js
Last active December 22, 2020 08:47
Responsive table - Adds th's to each td in mobile version
if(window.innerWidth < 768) {
$('table.content-table').each(function( index ) {
var ths = $( this ).find('th');
var trs = $( this ).find('tr');
trs.each(function(){
$(this).find('td').each(function(i){
var text="<span>"+ths.eq(i).html()+"</span>";
$(this).prepend(text);
})
});
@ankedsgn
ankedsgn / app.js
Created February 26, 2020 08:37
History path / breadcrumbs
$( document ).ready(function() {
/**
* breadcrumbs / history path
*/
breadcrumbStateSaver(document.location.href, document.title);
showBreadCrumb();
)};
//breadcrumbs -> https://stackoverflow.com/questions/18998797/create-breadcrumbs-dynamically-on-client-side-using-javascript
@ankedsgn
ankedsgn / contenttypes.yml and template.twig
Last active June 6, 2019 14:39
Multilanguage alts and titles in Bolt
in contenttypes.yml:
image:
type: image
attrib: [ alt_nl, title_nl, alt_en, title_en, alt_fr, title_fr ]
in de template:
{% set alt = attribute(record.values.image, 'alt_'~getlanguage() )|default('') %}
{% set title = attribute(record.values.image, 'title_'~getlanguage() )|default('') %}