Skip to content

Commit

Permalink
improved breakpoint handling, fixed issue with link exchange
Browse files Browse the repository at this point in the history
  • Loading branch information
thexmanxyz committed May 28, 2020
1 parent fcad90c commit 372ed16
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 15 deletions.
17 changes: 14 additions & 3 deletions src/default/owlcarousel-neo.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@
{% else %}
{% set slideLinkBreakpointPx = slideLinkBreakpointPx|slice(0, slideLinkBreakpointPx.length - 2) %}
{% endif %}
{% set slideLinkBreakpointPx = slideLinkBreakpointPx - 1 %}
{% endif %}

{% set slideItemStyle = (particle.delaySlideElements) ? 'display: none;' : '' %}
Expand Down Expand Up @@ -454,8 +455,12 @@
var link = jQuery(this).find('> a');
link.parent().html(link.html());
jQuery(this).find('[data-html]').each(function() {
jQuery(this).html(jQuery(this).attr('data-html'));
jQuery(this).removeAttr('data-html');
if(jQuery(this).is('h1')) {
jQuery(this).replaceWith(jQuery(this).attr('data-html'));
} else {
jQuery(this).html(jQuery(this).attr('data-html'));
jQuery(this).removeAttr('data-html');
}
});
}
}
Expand Down Expand Up @@ -535,7 +540,13 @@
{% if image.breakpoint and image.breakpoint != 'disable' %}
{% set imgWidth = (image.breakpoint == 'custom') ? image.customBreakpoint : gantry.config.styles.breakpoints[image.breakpoint] %}
{% if imgWidth and imgWidth != '' and image.img %}
<source {% if particle.lazyLoadImages %}class="owl-lazy" data-{% endif %}srcset="{{ url(image.img)|e }}" media="(max-width: {{ imgWidth|e }})">
{% if imgWidth ends with 'rem' %}
{% set imgWidth = (imgWidth|slice(0, imgWidth.length - 3)) * 16 %}
{% else %}
{% set imgWidth = imgWidth|slice(0, imgWidth.length - 2) %}
{% endif %}
{% set imgWidth = (image.breakpoint == 'custom') ? imgWidth : imgWidth - 1 %}
<source {% if particle.lazyLoadImages %}class="owl-lazy" data-{% endif %}srcset="{{ url(image.img)|e }}" media="(max-width: {{ imgWidth|e }}px)">
{% endif %}
{% endif %}
{% endfor %}
Expand Down
6 changes: 3 additions & 3 deletions src/default/owlcarousel-neo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ form:
type: input.text
label: Breakpoint
description: Define at what width (in pixel) the here defined options should be applied. The basic settings are overriden so you might need to define at least two breakpoints for your desired behavior.
placeholder: e.g. 768 (in pixel)
placeholder: e.g. 768 in pixel
default: ''
._info_responsive_settings:
type: separator.note
Expand Down Expand Up @@ -864,13 +864,13 @@ form:
label: Manual Width
description: The manual width applied to the <code>style</code> attribute of the slide item. This option should be used together with <strong>Manual Dimension</strong> located at the general slide settings.
default: ''
placeholder: e.g. 250 (in pixel)
placeholder: e.g. 250 in pixel
.manual_height:
type: input.text
label: Manual Height
description: The manual height applied to the <code>style</code> attribute of the slide item. This option should be used together with <strong>Manual Dimension</strong> located at the general slide settings.
default: ''
placeholder: e.g. 250 (in pixel)
placeholder: e.g. 250 in pixel
.link:
type: input.text
label: Link
Expand Down
6 changes: 3 additions & 3 deletions src/default/translation/de/owlcarousel-neo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ form:
type: input.text
label: Breakpoint
description: Legen Sie fest, bei welcher Breite (in Pixel) die hier definierten Optionen angewendet werde sollen. Die übergeordneten Einstellungen werden überschrieben, deshalb brauchen Sie wahrscheinlich zwei Breakpoints, um das erwartete Resultat zu erhalten.
placeholder: z.B.: 768 (in pixel)
placeholder: z.B.: 768 in pixel
default: ''
._info_responsive_settings:
type: separator.note
Expand Down Expand Up @@ -864,13 +864,13 @@ form:
label: Manuelle Breite
description: Die manuelle Breite die auf das <code>style</code> Attribut des Slideelements angewendet wird. Diese Option sollte zusammen mit der Einstellung <strong>Manuelle Größe</strong> in den allgemeinen Slide Einstellungen verwendet werden.
default: ''
placeholder: z.B.: 250 (in pixel)
placeholder: z.B.: 250 in pixel
.manual_height:
type: input.text
label: Manuelle Höhe
description: Die manuelle Höhe die auf das <code>style</code> Attribut des Slideelements angewendet wird. Diese Option sollte zusammen mit der Einstellung <strong>Manuelle Größe</strong> in den allgemeinen Slide Einstellungen verwendet werden.
default: ''
placeholder: z.B.: 250 (in pixel)
placeholder: z.B.: 250 in pixel
.link:
type: input.text
label: Link
Expand Down
6 changes: 3 additions & 3 deletions src/legacy/owlcarousel-neo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ form:
type: input.text
label: Breakpoint
description: Define at what width (in pixel) the here defined options should be applied. The basic settings are overriden so you might need to define at least two breakpoints for your desired behavior.
placeholder: e.g. 768 (in pixel)
placeholder: e.g. 768 in pixel
default: ''
._info_responsive_settings:
type: separator.note
Expand Down Expand Up @@ -867,13 +867,13 @@ form:
label: Manual Width
description: The manual width applied to the <code>style</code> attribute of the slide item. This option should be used together with <strong>Manual Dimension</strong> located at the general slide settings.
default: ''
placeholder: e.g. 250 (in pixel)
placeholder: e.g. 250 in pixel
.manual_height:
type: input.text
label: Manual Height
description: The manual height applied to the <code>style</code> attribute of the slide item. This option should be used together with <strong>Manual Dimension</strong> located at the general slide settings.
default: ''
placeholder: e.g. 250 (in pixel)
placeholder: e.g. 250 in pixel
.link:
type: input.text
label: Link
Expand Down
6 changes: 3 additions & 3 deletions src/legacy/translation/de/owlcarousel-neo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ form:
type: input.text
label: Breakpoint
description: Legen Sie fest, bei welcher Breite (in Pixel) die hier definierten Optionen angewendet werde sollen. Die übergeordneten Einstellungen werden überschrieben, deshalb brauchen Sie wahrscheinlich zwei Breakpoints, um das erwartete Resultat zu erhalten.
placeholder: z.B.: 768 (in pixel)
placeholder: z.B.: 768 in pixel
default: ''
._info_responsive_settings:
type: separator.note
Expand Down Expand Up @@ -867,13 +867,13 @@ form:
label: Manuelle Breite
description: Die manuelle Breite die auf das <code>style</code> Attribut des Slideelements angewendet wird. Diese Option sollte zusammen mit der Einstellung <strong>Manuelle Größe</strong> in den allgemeinen Slide Einstellungen verwendet werden.
default: ''
placeholder: z.B.: 250 (in pixel)
placeholder: z.B.: 250 in pixel
.manual_height:
type: input.text
label: Manuelle Höhe
description: Die manuelle Höhe die auf das <code>style</code> Attribut des Slideelements angewendet wird. Diese Option sollte zusammen mit der Einstellung <strong>Manuelle Größe</strong> in den allgemeinen Slide Einstellungen verwendet werden.
default: ''
placeholder: z.B.: 250 (in pixel)
placeholder: z.B.: 250 in pixel
.link:
type: input.text
label: Link
Expand Down

0 comments on commit 372ed16

Please sign in to comment.