Support iOS device

1. iOS device does not fire click event if A without href.
2. iOS device does not fire click event if Element cursor is not
pointer.
This commit is contained in:
Shiny
2015-08-10 13:28:58 +08:00
committed by Arnold Daniels
parent b9d0fd76e7
commit cdf7fd972f

View File

@@ -33,8 +33,10 @@
$(window).on('resize', $.proxy(this.recalc, this))
}
if (this.options.autohide && !this.options.modal)
$(document).on('click', $.proxy(this.autohide, this))
if (this.options.autohide && !this.options.modal) {
var eventName = (navigator.userAgent.match(/(iPad|iPhone)/i) === null) ? 'click' : 'touchstart'
$(document).on(eventName, $.proxy(this.autohide, this))
}
if (this.options.toggle) this.toggle()
@@ -358,12 +360,12 @@
$(document).on('click.bs.offcanvas.data-api', '[data-toggle=offcanvas]', function (e) {
var $this = $(this), href
var target = $this.attr('data-target')
|| e.preventDefault()
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
var $canvas = $(target)
var data = $canvas.data('bs.offcanvas')
var option = data ? 'toggle' : $this.data()
e.preventDefault();
e.stopPropagation()
if (data) data.toggle()