Add 2 onBefore events

I added possibility to specify callback function for `onBeforeOpen` and `onBeforeClose` events, which are triggered before zoom-in and zoom-out resp. 

It is useful, when you need to make something with target: specify classname, add some extra transition effects, etc.
Could you fix the indentation here?