Skip to content

Commit

Permalink
README: fix pjax compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed Nov 29, 2017
1 parent 8685095 commit 33c97ec
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,16 @@ for example:
{% dplayer 'url=some.mp4' "id=someid" "api=https://api.prprpr.me/dplayer/" "addition=/some.json" 'code=player.on("loadstart",function(){console.log("loadstart")})' "autoplay" %}


## Pjax compatible
## PJAX compatible

```js
$(document).on('pjax:start', function () {
try {
if (window.dplayers) {
for (let i = 0; i < window.dplayers.length; i++) {
window.dplayers[i].destroy();
}
for (let i = 0; i < window.dplayers.length; i++) {
window.dplayers[i].destroy();
}
window.dplayers = [];
}
}
catch (e) {
console.log(e);
}
});
```

Expand Down

0 comments on commit 33c97ec

Please sign in to comment.