当在jQuery中悬停在td上时,如何使td中的URL触发"a:hover"的CSS效果?
The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...
当在jQuery中悬停在td上时,如何使td中的URL触发"a:hover"的CSS效果?
你可以试试:
$( td ).hover(function() {
$(this).find( a ).mouseover();
}, function() {
$(this).find( a ).mouseout();
});
我希望那很容易,但似乎不会起作用,因为我正在通过Ajax加载表格,所以即使向其添加'live'也无济于事...
$( td ).live( hover ,function() { $(this).find( a.desc ).mouseover(); }, function() { $(this).find( a.desc ).mouseout(); });
$( td ).hover(function() {
$(this).find( a ).addClass( name-class-simulates-hover );
}, function() {
$(this).find( a ).removeClass( name-class-simulates-hover );
});
也许添加一个具有与您的a:hover相同效果的类?
某些活动不能用活胎或其他手段处理,因此,如果你发现迫切需要在新内容上增加活动,然后或实际上作为通过麻风机添加新内容的一部分,那么,你可以通过呼吁功能增加活动管理。
function AddHover()
{
$( td ).hover(function() {
$(this).find( a ).addClass( myHoverClass );
}, function() {
$(this).find( a ).removeClass( myHoverClass );
});
};
在AJAX加载中:
切除...
success: function(msg)
{
LoadTableData(msg);// this function would process and add your page elements
AddHover();// this then adds the events to the new markup
},
结束剪切-有关“success:”的更多详细信息,请参阅jQuery .ajax。
感谢您的意见,Thomas和Mark。
<强>托马斯:强>我尝试了你的方法,它没有起作用,但它给了我一个想法来稍微调整它,然后我让它工作了...
$( tr ).live( mouseenter ,function() {
$(this).find( a.desc ).addClass( bold );
}).live( mouseleave ,function(){ $(this).find( a.desc ).removeClass( bold ); });
上述法典是我的目前解决办法,其运作似乎不可行,因为需要重新生活,才能取消黑体,从而使用enter子和 mo子。
在 $(this).find( a.desc ).mouseover(); 上使用 mouseover 是行不通的... 它甚至让谷歌浏览器变得非常卡,所以我相信这不是一个好主意...
马克:这是一个相当有趣的主意,我会尝试一下,我尽量避免使用".live()",因为它似乎不是一种有效的方法,但这在Web 2.0时代相当困难。
The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...
How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.
I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...
I have a div <div id="masterdiv"> which has several child <div>s. Example: <div id="masterdiv"> <div id="childdiv1" /> <div id="childdiv2" /> <div id="...
I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.
I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...
Ok, I m stumped. Basically, this script works fine in FF, but not in IE (6,7 or 8) - in which it returns an "Object doesn t support this property or method" error. Any ideas?: function ...
What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...