May 2017
Intermediate to advanced
448 pages
10h 10m
English
Plugins that add custom selector expressions increase the capabilities of jQuery's built-in selector engine so that we can find elements on the page in new ways. Cycle adds a custom selector of this kind, which gives us an opportunity to explore this capability.
Cycle's slideshows can be paused and resumed by calling .cycle('pause') and .cycle('resume'), respectively. We can easily add buttons that control the slideshow, as shown in the following code:
$(() => { const $books = $('#books').cycle({ timeout: 2000, speed: 200, pause: true }); const $controls = $('<div/>') .attr('id', 'books-controls') .insertAfter($books); $('<button/>') .text('Pause') .click(() => { $books.cycle('pause'); }) .appendTo($controls); $('<button/>') ...Read now
Unlock full access