malsup / cycle2

2nd gen cycling
899 stars 236 forks source link

why do some options in the options object passed to .cycle() have an - in them? #806

Closed koenverburg closed 7 years ago

koenverburg commented 7 years ago

Im trying to get swiping to work, but swipe-fx will cause an error like SyntaxError: missing : after property id this is mainly caused by the - in the variable name.

my code

            $(".js-cycle-slideshow").cycle({
                allow-wrap: false,
                loop: 1,
                swipe: true,
                slides: "> .urenSchema-dag",
                //manual-fx: "scrollHorz"
                //swipeFx: "scrollHorz"
                timeout: 0

            });
gabrielfin commented 7 years ago

The "-" version is only if you pass the options through html attributes. ie: <div data-cycle-allow-wrap="false"> If you want to pass the options to the javascript function, you need to convert them to camelcase. In this case: allowWrap: false http://jquery.malsup.com/cycle2/api/#options

koenverburg commented 7 years ago

Thanks for clarifying!!