Reputation: 1295
in a page being iframed in I have this code
window.parent.trigger('swipeForward');
now i need to listen to this event in the parent
jQuery(document).ready(function () {
//how do i listen here for the swipeForward event
});
Upvotes: 0
Views: 70
Reputation: 1295
working code
jQuery(function() {
if (window!=window.top) {
parent.window.jQuery(window.parent).trigger('swipeForward');
}
});
code in parent page
jQuery(window).on('swipeForward', function () {
alert("swiped");
});
Upvotes: 0
Reputation: 219920
Just like you would any other event:
$(window).on('swipeForward', function () {
// code goes here...
});
Don't forget to wrap window.parent
in jQuery:
$(window.parent).trigger('swipeForward');
Upvotes: 1