Reputation: 2217
I have the following on a website:
<div id="info-icon"><a href="javascript:void(0);">info</a></div>
<div id="info-panel" style="display:none;">
<div id="info-close"></div>
<p>Hello</p>
</div>
Which is run by the following jquery:
$(window).load(function() {
$('#info-icon').on('tap', 'a', function () {
$('#info-panel').show('slow', function() {
});
});
$("#info-close").click(function () {
$("#info-panel").hide(1000);
});
});
It works fine in Firefox, Safari, IE and even Android, but fails to work on iphone. I've tried a couple of solutions including changing the .click() for .on ('tap') but nothing seems to work. What am I missing?
-edit- Fixed my example code, realised I had missed the a tag in the opening div.
Upvotes: 2
Views: 3722
Reputation: 73966
Try this:
$(document).on('touchstart click', '#info-icon', function () {
$('#info-panel').show('slow');
});
$(document).on('touchstart click', '#info-close', function () {
$("#info-panel").hide(1000);
});
Upvotes: 6