carlsednaoui / ouibounce

Increase your landing page conversion rates.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using without passing element doesn't work

hackuun opened this issue · comments

Hi. I was following your guides. This doesn't work.

var _ouibounce = ouibounce(false, {
  callback: function() { console.log('ouibounce fired!'); }
})

How to use this library without ouibounce-modal id?

Hello

When you use Ouibounce with first parameter as false you have to do your logic in the callback function. Like for me, in Angularjs (1.x) I do something like this:

function link(scope, el, attrs, ctrl): void {
	/**
	* Passing "false" as first argument allows
	* us to use the plugin without setting it on an element,
	* and instead use the callback function to do our thing.
	*/
	$window.ouibounce(false, {
		callback: () => {
			ctrl.show = !ctrl.show;
			scope.$apply();
		}
	});
}

Do you see "ouibounce fired!" in your console with your example?