Change jquery code for mobile users -
i launched new website - mollycampbelldesign.com
while doesn't adapt mobile users yet, decided site , continue forward go. problem far, phone icon in top left - right can toggle phone number clicking on phone icon. did mobile users can click on phone # without making box slide out. when you're viewing on desktop, nice able click entire number box make disappear. there way make mobile users 1 set of code, , desktop users another?
html code:
<div class="call-button"><p>call now: <a href="tel:8013827471">801-382-7471</a></p> <img src="/wp-content/themes/boilerplate/images/phone.gif" alt="call now"/></div>
js code:
$(document).ready(function() { $(".call-button img").toggle( function() { $(".call-button").animate({ left: "0" }, 1000 );}, function() { $(".call-button").animate({ left: "-225px" }, 1000 ); }); });
here's quick , dirty way:
var istouchdevice = "ontouchstart" in window; if(istouchdevice){ //do mobile stuff }
Comments
Post a Comment