Ero sivun ”Widget:Fullscreen” versioiden välillä
Järvi-meriwikistä
(3 välissä olevaa versiota samalta käyttäjältä ei näytetä) | |||
Rivi 5: | Rivi 5: | ||
var id = 'fs_' + Math.random().toString(16).slice(2); | var id = 'fs_' + Math.random().toString(16).slice(2); | ||
document.write( '<div id="' + id + '_container" style="float: right;"></div>' ); | document.write( '<div id="' + id + '_container" style="float: right;"></div>' ); | ||
− | + | ||
− | + | this[ id + '_jQt' ] = function() { | |
if ( typeof window.jQuery == 'undefined' ) { | if ( typeof window.jQuery == 'undefined' ) { | ||
− | setTimeout( function() { | + | setTimeout( function() { this[ id + '_jQt' ]() }, 300); |
} else { | } else { | ||
if ( jQuery( "#" + id + "_container" ).length > 0 ) { | if ( jQuery( "#" + id + "_container" ).length > 0 ) { | ||
− | + | this[ id + '_func' ](); | |
} else { | } else { | ||
− | setTimeout( function() { | + | setTimeout( function() { this[ id + '_jQt' ]() }, 300); |
} | } | ||
} | } | ||
} | } | ||
− | setTimeout( function() { | + | setTimeout( function() { this[ id + '_jQt' ]() }, 300); |
− | function | + | this[ id + '_func' ] = function() { |
var output = '<div class="fullscreen-button" style="margin-left: 10px; float: right; border-radius: 50%;"><button id="' + id + '_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 id="' + id + '_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>'; | ||
− | + | console.log( id ); | |
+ | console.log( jQuery( "#" + id + "_container" ) ); | ||
jQuery( "#" + id + "_container" ).html( output ); | jQuery( "#" + id + "_container" ).html( output ); | ||