Closed kyleellman closed 11 years ago
I think it's easier to make Pjax do what you want than turbolinks in this case.
On Feb 13, 2013, at 19:37, Kyle Ellman notifications@github.com wrote:
I'm curious if there is a way to not replace the entire body.
I'm hoping to have an element on the page that stays consistent (and plays media throughout page-changes). This doesn't seem to work, and detaching the div that enables the media playback kills playback permanently, so reattaching the player after page:change wouldn't work (and would have a gap in playback, anyway).
The following code works until a page-change.
class MediaPlayer constructor: -> @setupInterval = setInterval ( => if $('#mediaPlayer').length clearInterval @setupInterval @setup() ), 500
setup: => console.log 'setting up...' @player = $('#mediaPlayer') @player.jPlayer ready: => console.log 'seems to be working...' @player.jPlayer "setMedia", m4a: 'http://www.jplayer.org/audio/m4a/Miaow-07-Bubble.m4a' oga: 'http://www.jplayer.org/audio/ogg/Miaow-07-Bubble.ogg' @player.jPlayer 'play' swfPath: '/assets' supplied: 'm4a, oga' solution: 'flash, html'
Application.mediaPlayer = new MediaPlayer So, is there any way to make Turbolinks leave part of the page alone, or only change part of it? I know this is possible with Pjax, but the page-change callbacks that Turbolinks offers are invaluable to making the rest of my application work properly.
Any help would be appreciated.
— Reply to this email directly or view it on GitHub.
Good call. There's no point in trying to force Turbolinks into something it wasn't designed to do.
I'm curious if there is a way to not replace the entire body.
I'm hoping to have an element on the page that stays consistent (and plays media throughout page-changes). This doesn't seem to work, and detaching the div that enables the media playback kills playback permanently, so reattaching the player after page:change wouldn't work (and would have a gap in playback, anyway).
The following coffeescript works until a page-change.
So, is there any way to make Turbolinks leave part of the page alone, or only change part of it? I know this is possible with Pjax, but the page-change callbacks that Turbolinks offers are invaluable to making the rest of my application work properly.
Any help would be appreciated.