Several enhancements

1. Add a container directive, so it can work when the viewport is not window.
2. Observe source changes, so the image can be modifed at runtime.
3. Use methods provided by jquery whenever possible to improve compatibility and accuracy.