4

how can i detect jplayer is on full screen mode?

3 Answers 3

6

The jplayer adds a class of jp-video-full to the div when full screen.

You can use that selector for whatever you're trying to achieve.

if ($("#jp_container_1").hasClass("jp-video-full")) {
    //do something
} else {
   //do something else
}
7
  • 2
    And you can customize what class it uses (if you don't like jp-video-full)
    – Milimetric
    Apr 5, 2012 at 18:26
  • Good to know! I just took a quick look at the DOM. :} Apr 5, 2012 at 18:26
  • do i need to use something like jquery hasClass?
    – tetris
    Apr 5, 2012 at 18:52
  • You can, What are you trying to accomplish? Apr 5, 2012 at 18:53
  • to hide a couple of divs if jplayer is fullscreen, i put this in a if statement but does not work: $("div#jp_container_1").hasClass("jp-video-full")
    – tetris
    Apr 5, 2012 at 18:57
3

ok, this is how i had to go:

  $("a.jp-full-screen").click(function(){

  if($(this).attr("title")=="full screen"){
         $(".hover, ul#navigation").hide()
  }
  })


  $("a.jp-restore-screen").click(function(){
     if($(this).attr("title")=="restore screen"){
         $(".hover, ul#navigation").show()
  }
 })
1
  • Thx, I was just looking for this!
    – Luis
    Jul 27, 2012 at 21:57
0
if ($("#jp_container_1").status.cssClass == 'jp-video-full') {} else {}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.