1

I am currently in the process of building a web app. I am trying to get an image when clicked to change image source and then hide one div and show another. This seems to work fine when viewing within a browser but when viewed on an iPad the button image change doesn't work. An example of what I am currently doing is below:

$("#pg3rgt_en_GB").click(function(){
$(this).css("background-image","url(images/right-button-down.jpg)");
setTimeout(function(){
$("#introduction_en_GB").hide();
$("#pg3rgt_en_GB").css("background-image","url(images/right-button.jpg)");
$("#customerinput_en_GB").show();},250);

I hope that this is something simple I am missing. I appreciate any help and thanks in advance!

KM123
  • 1,339
  • 1
  • 10
  • 21
  • $("#pg3rgt_en_GB").css("background-image","url('images/right-button.jpg')"); add single quotes may work – Somnath Kharat Jan 14 '14 at 11:53
  • Thank you for your suggestion - I have just tried this and no luck. for some reason when testing the highlight will work on the odd occasion. – KM123 Jan 14 '14 at 12:19
  • missing }); at the end – Somnath Kharat Jan 14 '14 at 12:28
  • Just checked my code and it was my mistake in copying it. It is there I just didn't copy it :/ – KM123 Jan 14 '14 at 12:30
  • 1
    the hide and show functions arent supported in Safari. See the [Safari CSS Reference](https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariCSSRef/Articles/StandardCSSProperties.html) > Visual Effects... You'll need a CSS hack to change hide/show to visible:hidden and visible:visible – eyoung100 May 22 '14 at 21:42
  • Thank you very much!! That explains a lot lol :D – KM123 May 22 '14 at 21:45
  • See also: [Hide and show function not working in Safari](http://stackoverflow.com/questions/16736762/hide-and-show-function-not-working-in-safari), besides visible, you can use display:none – eyoung100 May 22 '14 at 21:47

1 Answers1

1

Safari doesn't recognise the show and hide features that jQuery has to offer. The best way around this would be to assign different css classes - which safari does recognise!