splide icon indicating copy to clipboard operation
splide copied to clipboard

Data attributes not being parsed

Open habitualshaker opened this issue 6 years ago • 1 comments

Getting a parsing issue whenever I try to use the data-attributes approach to pass in the options.

image

Using just the basic html markup from demo site.

<div class="splide" data-splide="{"type":"loop","perPage":3}">
	<div class="splide__track">
		<ul class="splide__list">
			<li class="splide__slide">Slide 01</li>
			<li class="splide__slide">Slide 02</li>
			<li class="splide__slide">Slide 03</li>
		</ul>
	</div>
</div>

habitualshaker avatar Apr 14 '20 15:04 habitualshaker

I forgot to escape HTML special characters the JSON in the document.

Please try to use single quotes:

data-splide='{"type":"loop","perPage":3}'

or escape double quotes:

data-splide="{&quot;type&quot;:&quot;loop&quot;,&quot;perPage&quot;:3}"

ghost avatar Apr 15 '20 08:04 ghost