Skip to content

Commit

Permalink
Add code tag to highlight in README
Browse files Browse the repository at this point in the history
  • Loading branch information
David Cetinkaya committed Jan 31, 2020
1 parent cece312 commit e0314b0
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ rewindButton.addEventListener('click', () => embla.scrollTo(0), false)
This API method allows users to manipulate the current
<a href="#scrollprogress">
<code>scrollProgress</code>
</a> by either adding to it or subtracting from it. For example, assuming that the carousel is positioned on the first snap point, `0.5` will scroll the carousel half of its scrollable length. Scroll to target is smooth.
</a> by either adding to it or subtracting from it. For example, assuming that the carousel is positioned on the first snap point, <code>0.5</code> will scroll the carousel half of its scrollable length. Scroll to target is smooth.
</div>
<br>
<div>
Expand Down Expand Up @@ -1206,8 +1206,8 @@ const togglePrevButtonEnabled = () => {
}
}

embla.on('init', togglePrevButtonEnabled);
embla.on('select', togglePrevButtonEnabled);
embla.on('init', togglePrevButtonEnabled)
embla.on('select', togglePrevButtonEnabled)
```

```html
Expand Down Expand Up @@ -1272,8 +1272,8 @@ const toggleNextButtonEnabled = () => {
}
}

embla.on('init', toggleNextButtonEnabled);
embla.on('select', toggleNextButtonEnabled);
embla.on('init', toggleNextButtonEnabled)
embla.on('select', toggleNextButtonEnabled)
```

```html
Expand Down Expand Up @@ -1436,8 +1436,8 @@ embla.on('select', () => {
const embla = EmblaCarousel(emblaNode, options)
const scrollSnaps = embla.scrollSnapList()

const slidesInFirstScrollSnap = scrollSnaps[0].slideNodes;
const indexesInFirstScrollSnap = scrollSnaps[0].slideIndexes;
const slidesInFirstScrollSnap = scrollSnaps[0].slideNodes
const indexesInFirstScrollSnap = scrollSnaps[0].slideIndexes
```

<hr>
Expand Down Expand Up @@ -1488,8 +1488,8 @@ const indexesInFirstScrollSnap = scrollSnaps[0].slideIndexes;
const embla = EmblaCarousel(emblaNode, options)

embla.on('scroll', () => {
const scrollProgressPercentage = embla.scrollProgress() * 100
console.log(`The carousel has scrolled ${scrollProgressPercentage}%.`)
const scrollPercentage = embla.scrollProgress() * 100
console.log(`The carousel has scrolled ${scrollPercentage}%.`)
})
```

Expand Down Expand Up @@ -1538,7 +1538,7 @@ embla.on('scroll', () => {
const embla = EmblaCarousel(emblaNode, options)
const emblaSlides = embla.slideNodes()

const alertClickedSlide = (index) => {
const alertClickedSlide = index => {
return () => {
if (embla.clickAllowed()) {
alert(`Slide with index ${index} was clicked.`)
Expand Down Expand Up @@ -1715,7 +1715,6 @@ embla.on('init', onInitCallback)

##### `off`


<details>
<summary>
Unsubscribe from an Embla specific event.
Expand Down Expand Up @@ -1765,12 +1764,13 @@ embla.on('init', onInitCallback)
```javascript
const embla = EmblaCarousel(emblaNode, options)

const logIndexToConsole = () => {
console.log(`Selected index has changed to ${embla.selectedScrollSnap()}.`)
const logIndex = () => {
const selectedIndex = embla.selectedScrollSnap()
console.log(`Selected index has changed to ${selectedIndex}.`)
}

const addLogIndexListener = () => embla.on('select', logIndexToConsole);
const removeLogIndexListener = () => embla.off('select', logIndexToConsole);
const addLogIndexListener = () => embla.on('select', logIndex)
const removeLogIndexListener = () => embla.off('select', logIndex)
```

<hr>
Expand Down Expand Up @@ -1914,8 +1914,8 @@ const embla = EmblaCarousel(emblaNode, options)
const embla = EmblaCarousel(emblaNode, options)

embla.on('scroll', () => {
const scrollProgressPercentage = embla.scrollProgress() * 100
console.log(`The carousel has scrolled ${scrollProgressPercentage}%.`)
const scrollPercentage = embla.scrollProgress() * 100
console.log(`The carousel has scrolled ${scrollPercentage}%.`)
})
```

Expand Down

0 comments on commit e0314b0

Please sign in to comment.