棘轮删除/添加数据-忽略=“推”

Ratchet remove/add data-ignore="push"

本文关键字:忽略 数据 删除 添加      更新时间:2023-09-26

使用棘轮框架,我能够滑进/滑出任何页面,我到达的情况是,我必须先获得数据,然后才能滑到下一页。我可以得到数据,但是页面的幻灯片转换消失了。有办法做到这一点吗?

我有这个例子锚在这里:

<a href="next-link.html" data-transition="slide-in" data-want="I want this data here">Next link</a>

试着使用,

$('a').each(function() {

`var $this = $(this);`
`$this.attr('data-ignore', 'push');`
`$this.click(function(e) {`
    `e.stopPropagation();`
    `//... get the data here $this.attr('data-want')`
    `$this.attr('data-ignore', '');`
`});`

});

.data()代替:

$this.data('ignore', 'push');

并将其设置为空

$this.data('ignore', '');

这就是我使用的,"on"的优点是,无论何时将a标记附加到页面上,它都可以工作。如果你想的话,你可以删除if语句,我用的是PhoneGap所以这为我解决了一些问题。

        $(document.body).on('click', 'a', function(e){
            $(this).attr('data-ignore', 'push');    //disables ratchet push.js for now!
            var url = $(this).attr('href');
            if (url && url.indexOf('http') == -1) {
                location.href = url;
            }
        });