JSNI GWT jquery [英] JSNI GWT jquery

查看:92
本文介绍了JSNI GWT jquery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个jQuery文件来创建翻转卡效果,并将其更改为JSNI,使用本机功能但错误。我不知道什么是错的。有谁能够帮助我?
这是我的本地函数:

pre $ public native void flip()/ * - {
$(文件).ready(function(){
$('#nav-list-example div div.back')。hide()。css('left',0);

函数mySideChange(front){
if(front){
$(this).parent()。find('div.front')。show();
$(this)。 parent()。find('div.back')。hide();

} else {
$(this).parent()。find('div.front')。 hide();
$(this).parent()。find('div.back')。show();
}
}

$( '#nav-list-example div').hover(
function(){
$(this).find('div')。stop()。rotate3Di('flip',250,{方向:'顺时针',sideChange:mySideChange});
},
函数(){
$(this).find('div')。stop()。rotate3Di('unflip ',500,{sideChange:mySideChange});
}
);
});
} - * /;


解决方案

JSNI 101 $ wnd。$($ doc).ready(function($){... $ b

使用 $ 作为回调函数的参数应该允许使用 $ ,而不是 $ wnd。$


I have a file jQuery to create the flip card effect and I changed it to JSNI, use native function but error. I don't know what's wrong. Can anybody help me? This is my native function:

public native void flip() /*-{
$(document).ready(function () {
    $('#nav-list-example div div.back').hide().css('left', 0);

    function mySideChange(front) {
        if (front) {
            $(this).parent().find('div.front').show();
            $(this).parent().find('div.back').hide();

        } else {
            $(this).parent().find('div.front').hide();
            $(this).parent().find('div.back').show();
        }
    }

    $('#nav-list-example div').hover(
        function () {
            $(this).find('div').stop().rotate3Di('flip', 250, {direction: 'clockwise', sideChange: mySideChange});
        },
        function () {
            $(this).find('div').stop().rotate3Di('unflip', 500, {sideChange: mySideChange});
        }
    );
});
         }-*/;

解决方案

JSNI 101: $wnd.$($doc).ready(function($) {…

Using $ as the argument to the callback function should allow using $ inside the function instead of $wnd.$.

这篇关于JSNI GWT jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆