jquery-events

Detect pinch to zoom when 'user-scalable' is set to yes

一曲冷凌霜 提交于 2019-12-10 13:10:05
问题 How can I detect the scale (or distance pinched) of the pinch to zoom when the meta name="viewport" is set to user-scalable=yes ? I've tested on Android but the pinch to zoom can't be detected if the meta name="viewport" is set to user-scalable=yes . If the meta name="viewport" is set to user-scalable=no then the pinch to zoom can be detected but then I'm not able to zoom in on the document. Here are my tests on jsFiddle: Hammer.js: http://jsfiddle.net/pE42S/ var pziW = "test"; var viewport

What is the difference between jQuery off() and unbind()

 ̄綄美尐妖づ 提交于 2019-12-10 12:31:07
问题 I was using jQuery .bind() and .unbind() to handle an animation event on scroll. $(window).bind('scroll', function(){ ... code ... if(code_was_successful){ $(window).unbind(e); } }); As of 1.7 (I'm using 1.11) we're supposed to use .on() and .off() , but .off() seems to have no support for an event handler unbinding itself. For normal click events and such, I'd have to save the handler to a variable and set up another event handler to unbind it (which defeats the purpose), and for scroll

With jQuery, How Do I Intercept Hyperlink Click Events Temporarily?

北城余情 提交于 2019-12-10 01:52:37
问题 This question refers to affiliate marketing, but really is a generic question about intercepting hyperlinks before they go off to another site, where you can log visitor activity to a database. My affiliate marketing client had a really good question. Imagine a scenario where you have products pulled back from Amazon over its API, given a seed keyword. Now imagine a visitor clicks one of those products to view it on Amazon. The URL for that product might look like this (and this is just a

Javascript click and mousedown conflicting

蓝咒 提交于 2019-12-10 00:50:31
问题 I have a certain scenario where I'm using click to insert a div and then mousedown on that div for dragging it around. I have bound the click to the parent container, and the mousedown on the div itself. But when I mousedown on the div, it fires the click on the parent as well, hence inserting multiple divs instead of dragging the already added div! Is there a way to solve this issue? I can't unbind click , since I need to add 2 divs using the click , and then bind mousedown on these. Update:

Detect if a scroll event is triggered manually in jQuery

做~自己de王妃 提交于 2019-12-09 02:39:48
问题 This question was already asked here a long time ago: Detect jquery event trigger by user or call by code But it has never been answered conclusively (or maybe I'm simply not able to search properly). Is it possible to detect whether a scroll event has been triggered by the user or by the jQuery animate function? I am trying to prevent the scroll event to trigger itself while doing something like this: $(document).scroll(function(){ $("html").stop(true); var number = 400; //some other stuff

'show' event doesn't fire in IE9 using Twitter Bootstrap Modal in Rails

百般思念 提交于 2019-12-08 15:58:46
问题 I have an issue involving a couple of different frameworks/libs although the main ones being Twitter Bootstrap(js) and Rails. I have a link in my app that responds with some js: $(function() { var $modal = $('<%= escape_javascript( render 'front_end/bookings/modal', :product => @product, :customer => @customer, :booking => @booking ) %>'), $calendar = $modal.find('#calendar'), currentProduct = <%= raw(@product.to_json) %>;, initBookingCalendar; $('body').append($modal); $modal.modal('show');

How to make sure only one event handler get called when select radio buttons very fast?

随声附和 提交于 2019-12-08 12:35:08
问题 If I have radio buttons : <input id="y0" type="radio" name="myRadioBtns" value="a" checked> <label for="y0"></label> <input id="y1" type="radio" name="myRadioBtns" value="b"> <label for="y1"></label> <input id="y2" type="radio" name="myRadioBtns" value="c"> <label for="y2"></label> To make sure that the "change" event is only bound to the radio buttons once, I did something like this: var $el = $('input[name='myRadioBtns']'); if(!($el.data('events') && $el.data('events').change)) { $el.change

jQuery 'click' event doesn't work on iOS Safari?

匆匆过客 提交于 2019-12-08 09:12:24
问题 This is a strange one. I have a delegated 'click' event that doesn't seem to work on iOS. But if I change the event to 'click touchstart', it works. See below: $('body').on 'click touchstart', '#cartut-proddetail', -> $(@).fadeOut -> $(@).remove() $('#cartut-overlay').fadeOut -> $(@).remove() Basically, #cartut-proddetail is an overlay behind a modal. So when the user taps off the modal, I want to remove all overlays. Without touchstart , though, nothing happens. Why is that? Other click

Does an Uncaught TypeError in jQuery come from code conflict?

时光总嘲笑我的痴心妄想 提交于 2019-12-08 02:58:25
问题 Tumblr's login page is an inspiration for many, and as a hobbyist developer I was looking to see how they made their login form. I took away the superfluous code and came up with a simplified version, like so: <div id="login_form_container"> <form method="post" action="logged-in.html" id="login_form"> <div class="input_wrapper"> <label for="login_email">Email address</label> <input type="text" name="email" id="login_email" value=""> </div> <button type="submit"><span>Log In</span></button> <

jQuery jeditable trigger on click

南笙酒味 提交于 2019-12-07 15:44:58
问题 I need to use inline edit in my application. For this purpose I am using the Jeditable plugin for jQuery. I want to trigger editable mode for an element only when I click on it. This is my code which doesn't work: var tet = ""; $(".edit-client").click(function(event) { tet = "#"+event.target.id; //alert(tet); }); $(tet).editable("/bestcredit/admin.php/request/editClient", { submitdata : function (value,settings){ return {"Client[id]":'.$model->client->id.' }; }, //indicator : "Saving...", /