updated javascript

added conditional for mobile