jquery-1.8

jQuery 1.8: unsupported pseudo: hover

时间秒杀一切 提交于 2019-11-27 16:09:02
The following code raises the error unsupported pseudo: hover on jQuery 1.8, while it works perfect on jQuery 1.7.2: if(!$(this).parent().find('ul').first().is(':hover')) { $(this).parent().parent().removeClass('open'); } Does anyone know what's going on? Brian Unfortunately, while we all wish that our code were future proof, your $('foo').on( 'hover, ... function(){ //do stuff } code is deprecated in jQuery 1.8 . I wish I had better news for you, but your code is broken because of a core change to jQuery 1.8. You now have to use the syntax $('.selector').on( 'mouseenter mouseleave', function(

jQuery .toggle event deprecated, What to use?

邮差的信 提交于 2019-11-27 07:56:13
问题 Since the jQuery .toggle event method is deprecated. What are we suppose to use to simulate this event (alternate clicks)? 回答1: Add this outside of document.ready $.fn.clicktoggle = function(a, b) { return this.each(function() { var clicked = false; $(this).click(function() { if (clicked) { clicked = false; return b.apply(this, arguments); } clicked = true; return a.apply(this, arguments); }); }); }; then use the following to replicate the .toggle functionality: $("#mydiv").clicktoggle

jQuery 1.8 find event handlers

本秂侑毒 提交于 2019-11-26 22:40:30
How to find event handlers on an object in jQuery 1.8+? var func = function(){ alert(1); }; var obj = $('#obj'); obj.on("click", func); // obj.data('events') is undefined Use the data function as is done by jQuery internally . On previous versions, you could call it like for other data : obj.data('events'); In jQuery 1.8, this direct access was removed , so in recent versions you must call it like this : $._data(obj[0], "events") You can see it in action by opening the console in this fiddle : http://jsfiddle.net/8TpeP/2/ to find event handlers of an element in jQuery 1.8+ you've got to do

jQuery 1.8: unsupported pseudo: hover

限于喜欢 提交于 2019-11-26 17:20:04
问题 The following code raises the error unsupported pseudo: hover on jQuery 1.8, while it works perfect on jQuery 1.7.2: if(!$(this).parent().find('ul').first().is(':hover')) { $(this).parent().parent().removeClass('open'); } Does anyone know what's going on? 回答1: Unfortunately, while we all wish that our code were future proof, your $('foo').on( 'hover, ... function(){ //do stuff } code is deprecated in jQuery 1.8. I wish I had better news for you, but your code is broken because of a core

jQuery 1.8 find event handlers

北慕城南 提交于 2019-11-26 08:24:35
问题 How to find event handlers on an object in jQuery 1.8+? var func = function(){ alert(1); }; var obj = $(\'#obj\'); obj.on(\"click\", func); // obj.data(\'events\') is undefined 回答1: Use the data function as is done by jQuery internally. On previous versions, you could call it like for other data : obj.data('events'); In jQuery 1.8, this direct access was removed, so in recent versions you must call it like this : $._data(obj[0], "events") You can see it in action by opening the console in