D3.js zoom.on() Function
The zoom.on() Function in D3.js is used to set the event listener for the specified typenames and returns the zoom behaviour. If an event listener was already registered for the same type and name, the existing listener is removed before the new listener is added.
Parameters: This function accepts a single parameter as mentioned above and described below
- typenames: This parameter is the string containing one or more typename separated by whitespace.
- listener: This parameter is an optional parameter and it is a function.
Return Value: This function returns the zoom behaviour.
Below programs illustrate the zoom.on() function in D3.js