jquery-events

jQuery/js/html5 change page content when keyboard is visible on mobile devices [duplicate]

左心房为你撑大大i 提交于 2019-11-28 16:45:08
Possible Duplicate: iPad Web App: Detect Virtual Keyboard Using JavaScript in Safari? I'm building a mobile version for a website, and I'm interested if I can create using jQuery/js/html5 or any other technology the same split screen effect that can be made on mobile apps when virtual keyboard is visible. For example if a user enters my webpage and clicks on an input text field, the virtual keyboard is showed and the browser automatically zooms to the area where the input text field is. What I want is to be able to change my page content the moment the virtual keyboard is visible based on the

Using Firefox, how can I monitor all events that are fired?

旧巷老猫 提交于 2019-11-28 15:43:26
I'm trying to debug a web page that makes heavy use of events, and so I need to monitor all events that are fired. Most of the events are bound using jQuery. Hence, it would be particularly useful if there was a way to specifically monitor only those events. Of course you can do just fine with Firebug , the console and the scripts tab where you can add breakpoints and watches, but you want to do it smarter / easier obviously. There is a neat Firebug plugin called EventBug that just logs all the events and groups them by event type so you can expand and see what triggered them. EventBug doesn't

Twitter bootstrap stop propagation on dropdown open

徘徊边缘 提交于 2019-11-28 10:43:06
I have a twitter bootstrap dropdown inside a div with the plugin jOrgChart. The problem I'm having is that when I click the button to open the dropdown menu it also triggers a click event in the parent div that does a collapse of other elements. This is my html: <div id="chart"> <div class="node"> <div class="btn-group"> <a class="btn dropdown-toggle" data-toggle="dropdown" href="#"> Actions <span class="caret"></span> </a> <ul class="dropdown-menu" style="text-align:left;"> <li><a href="#">Edit</a></li> <li><a href="#">Delete</a></li> </ul> </div> </div> <div class="node"> ... </div> I want

In html5, Javascript is there a way to make a polygon I just draw draggable? or listen to mouse events?

房东的猫 提交于 2019-11-28 06:53:02
问题 I draw a polygon with the following code: var canvas = document.getElementById("polyCanvas"); var c2 = canvas.getContext("2d"); var coords = ''; c2.clearRect(0, 0, 2000, 2000); $("fdel").remove(); $("#eliminar" + todelete).remove(); c2.beginPath(); var first = true; var points = 1; var done = false; $("#vertexcontainer .vertex").each(function() { var position = $(this).position(); var x = 2+position.left; var y = 2+position.top; if (!done){ if (first) { c2.moveTo(x, y); first = false; } else

How to attach a event to a jQuery mobile page using on() and off()?

一世执手 提交于 2019-11-28 05:40:43
问题 I'm trying to upgrade to lasted Jquery 1.7.1 (using JQM 1.1pre). I used to be able to bind to a JQM page like this: $('#mypage').live('pageshow', function() { /* do stuff */ }) Per Jquery 1.7.1 this would now have to be: $('#mypage').on('pageshow', function() { /* do stuff */ }) Or if the page is dynamically inserted $('body').on('pageshow', '#mypage', function() { /* do stuff */ }) Questions: - Is this syntax correct for jquery 1.7+? - I cannot get the events to fire at all in JQM using this

$(window).scroll() firing on page load

瘦欲@ 提交于 2019-11-28 03:46:56
问题 Is there a way to prevent $(window).scroll() from firing on page load? Testing the following code in Firefox 4, it fires even when I unplug the mouse. jQuery(document).ready(function($){ $(window).scroll(function(){ console.log("Scroll Fired"); }); }); 回答1: The scroll event is unrelated to the mouse, it is called whenever a new document scrolling position is set. And arguably that position is set when the document loads (you might load it with an anchor after all), also if the user presses a

Unbind jQuery even handler

戏子无情 提交于 2019-11-28 03:23:10
问题 I try to answer this question a few minutes ago and prepared this example for myself : <script> function trialMethod() { alert('On Submit Run!'); return true; } function trialMethod2() { alert('On Submit Run trialMethod2!'); return true; } </script> <form id="aspnetForm" onsubmit="trialMethod();"> <input type="submit"> </form> Why the first unbind doesn't work : <input type="button" id="btnTrial1" value="UNBIND 1" onclick="$('#aspnetForm').unbind('submit', trialMethod);"> But this one works

jQuery Mouse Direction Plugin [closed]

自闭症网瘾萝莉.ら 提交于 2019-11-28 01:34:33
问题 Sorry, it's more of an answer than a question. I've seen many people asking how to identify directional mouse movements using js/jQuery and this is a plugin I wrote for them this afternoon. jQuery provides support for standard JS mouse events as well as some custom ones. In jQuery it's easy to capture whether mouse point has entered in the boundary of an object or left from (mouseenter, mouseleave) or something else happened (like click, dblclick etc). But you are in trouble if you need to

Get clicked element in delegated event with jQuery

徘徊边缘 提交于 2019-11-27 22:47:51
问题 I have some elements that I add to the DOM after the page has been loaded. And I'd like to perform some actions when I click on them. I'm using the delegation with jQuery but I don't know how to get the clicked element when I'm in the fonction ($(this) refers in this case to the parent) <div id="parent"> <div class="child"> <div class="hidden"></div> </div> <div class="child"> <div class="hidden"></div> </div> </div> <script> $('#parent').click('.child', function(){ $(this).find('.child')

Why clicking on checkbox does not add the attribute checked='checked' [closed]

强颜欢笑 提交于 2019-11-27 22:05:18
问题 When I click a checkbox, why does checked attribute is not getting added?. You can see the code here http://jsfiddle.net/FCrSg/ 回答1: What are you trying to do? Find out if its checked? $('.user_roles').click(function(){ console.log( $(this).is(':checked')); }); http://jsfiddle.net/petersendidit/FCrSg/1/ 回答2: The HTML attribute checked means: checked by default , when the page loads. This won't change when the checkbox is clicked. <input type="checkbox" checked="checked"> <!-- The HTML