Ero sivun ”Widget:Fullscreen” versioiden välillä
Järvi-meriwikistä
Rivi 22: | Rivi 22: | ||
jQuery( "#<!--{$id|default:Fullscreen|escape:'html'}-->_container" ).html( output ); | jQuery( "#<!--{$id|default:Fullscreen|escape:'html'}-->_container" ).html( output ); | ||
+ | |||
+ | jQuery( "#<!--{$id|default:Fullscreen|escape:'html'}-->_button" ).on( 'click', function() { | ||
− | + | console.log( 'asdfsad' ); | |
− | + | ||
− | + | var elem = jQuery ( this ).parent( '.JwCard' ); | |
− | + | ||
− | + | if (!!document.fullscreenElement) { | |
− | |||
− | |||
− | |||
− | |||
− | + | if (document.exitFullscreen) { | |
− | + | document.exitFullscreen(); | |
− | + | } else if (document.mozCancelFullScreen) { /* Firefox */ | |
− | + | document.mozCancelFullScreen(); | |
− | + | } else if (document.webkitExitFullscreen) { /* Chrome, Safari and Opera */ | |
− | + | document.webkitExitFullscreen(); | |
− | + | } else if (document.msExitFullscreen) { /* IE/Edge */ | |
− | + | document.msExitFullscreen(); | |
− | + | } | |
− | + | jQuery( this ).html( '<i class="fas fa-expand"></i>' ); | |
− | + | } else { | |
− | + | if (elem.requestFullscreen) { | |
− | + | elem.requestFullscreen(); | |
− | + | } else if (elem.mozRequestFullScreen) { /* Firefox */ | |
− | + | elem.mozRequestFullScreen(); | |
− | + | } else if (elem.webkitRequestFullscreen) { /* Chrome, Safari and Opera */ | |
− | + | elem.webkitRequestFullscreen(); | |
− | + | } else if (elem.msRequestFullscreen) { /* IE/Edge */ | |
− | + | elem.msRequestFullscreen(); | |
− | + | } | |
− | + | jQuery( this ).find( 'button' ).html( '<i class="fas fa-compress"></i>' ); | |
− | + | } | |
− | + | }); | |
+ | |||
+ | } | ||
})(); // We call our anonymous function immediately | })(); // We call our anonymous function immediately | ||
</script> | </script> | ||
</includeonly> | </includeonly> |