Ero sivun ”Widget:Fullscreen” versioiden välillä
Järvi-meriwikistä
Rivi 17: | Rivi 17: | ||
setTimeout( function(){ <!--{$id|default:Fullscreen|escape:'html'}-->_jQueryTest() }, 300); | setTimeout( function(){ <!--{$id|default:Fullscreen|escape:'html'}-->_jQueryTest() }, 300); | ||
− | function <!--{$id|default:Fullscreen|escape:'html'}-->_func() { | + | function <!--{$id|default:Fullscreen|escape:'html'}-->_func() { |
var output = '<div class="fullscreen-button" style="margin-left: 10px; float: right; border-radius: 50%;"><button title="fullscreen" style="width: 24px; height: 24px; padding: 0; margin: 0; color: #1B599B; background: none; border: none;"><i class="fas fa-expand"></i></button></div>'; | var output = '<div class="fullscreen-button" style="margin-left: 10px; float: right; border-radius: 50%;"><button title="fullscreen" style="width: 24px; height: 24px; padding: 0; margin: 0; color: #1B599B; background: none; border: none;"><i class="fas fa-expand"></i></button></div>'; | ||
Rivi 24: | Rivi 24: | ||
} | } | ||
+ | |||
+ | jQuery( "#<!--{$id|default:Fullscreen|escape:'html'}-->_container 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> |