write interaction as jQuery plugin