Skip to content

Conversation

@iliketomatoes
Copy link

With the current version of cta.js, when we invoke the cta function, the second argument we pass must be an HTML element object (which represents the target).

With this new feature we can eventually use a function or either an array as a second argument.
To make things work out we have to follow these rules:

  • If we use a function as the target argument, that function must return an HTML element object.
  • If we use an array as the target argument, that array must hold at least one value and can hold at most two values. The type of the values can either be an HTML element object or a function that returns an HTML element object. If a second value is present into the array, we are telling cta that we want our modal window to target a different HTML element when we close the said window. (This can be useful in some peculiar navigation patterns, I can provide an example if you ask).

I hope this can be useful for the development of this powerful and elegant plugin. At least it's been useful for me :-)

@iliketomatoes
Copy link
Author

iliketomatoes commented Jul 6, 2016

See the working example at http://www.interpromotion.com/ , in the section "Works" . I made cta.js work together with a carousel. Hence the dynamic selection of the closing HTML element.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant