Skip to content

Instantly share code, notes, and snippets.

View ankedsgn's full-sized avatar

Anke ankedsgn

  • Flink
View GitHub Profile
@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 / 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 / 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 / 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>
{# 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">
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;
}
@ankedsgn
ankedsgn / visuallyhidden.scss
Created August 14, 2020 07:42
Visually hidden
// http://hugogiraudel.com/2016/10/13/css-hide-and-seek/ Screenreaders-only sr-only
.invisible-accessible, .sr-only {
border: 0 !important;
clip: rect(1px, 1px, 1px, 1px) !important;
-webkit-clip-path: inset(50%) !important;
clip-path: inset(50%) !important;
height: 1px !important;
overflow: hidden !important;
padding: 0 !important;
position: absolute !important;
@ankedsgn
ankedsgn / nav.twig
Created December 17, 2020 10:35
Check drupal for url in twig
{% set currenturl = url('<current>')|render|render %}
<select class="nav-top-level__select" name="nav-select" id="structure-nav-select" onchange="navSelect(value);">
{% for item in menu %}
<option value="{{ item.url }}" {% if item.url in currenturl %} selected {% endif %}>{{ item.text }}</option>
{% endfor %}
</select>
@ankedsgn
ankedsgn / app.js
Created February 23, 2021 12:36
check if checkbox is checked + do something with parent
$('.training-index__filters-form-inner .form-checkbox').each(function () {
if (this.checked) {
// console.log('YES');
$(this).parents('.fieldset-wrapper').show();
$(this).parents('fieldset legend').toggleClass('is-open');
}
});
@ankedsgn
ankedsgn / image-overlay.html.twig
Last active May 6, 2021 15:06
Image overlay in drupal, copied from paragraph to bottom of document
{% set classes = [
'paragraph',
'paragraph--type--' ~ paragraph.bundle|clean_class,
view_mode ? 'paragraph--view-mode--' ~ view_mode|clean_class,
not paragraph.isPublished() ? 'paragraph--unpublished',
'grid grid--medium image-overlay',
grid_medium
] %}