1

Using ratchet framework, I am able to slidein/slideout of any pages, I arrive on a situation where I have to get the data first before it slides to the next page. I can get the data but the slide transition of the page is gone. Is there a way to do this?

I have this example anchor here:

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

tried using,

$('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', '');`

`});`

});

Mo.
  • 26,306
  • 36
  • 159
  • 225
meetmahpuppy
  • 418
  • 1
  • 4
  • 17

2 Answers2

0

use .data() instead:

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

and to set it empty

$this.data('ignore', '');
Milind Anantwar
  • 81,290
  • 25
  • 94
  • 125
  • Nope, it still the same. .attr('data-value') and .data('value') is just the same right? – meetmahpuppy May 29 '14 at 18:22
  • 1
    yes I have. It is basically the same. but ooopsss, I have found the answer. e.stopPropagation() should not be there. It's suppressing/bubbling of push.js. Silly me! :) Thank you btw. – meetmahpuppy May 29 '14 at 18:27
0

This is what I use, the advantage of "on" is that it will work whenever an a tag is appended to the page. You can remove the if statement if you want to, I'm using PhoneGap so this gets around some issues for me.

        $(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;
            }
        });
Nico Westerdale
  • 2,147
  • 1
  • 24
  • 31