fixed a bug going from mobile to desktop, made script into jQuery plugin