Warning: Declaration of syntax_plugin_syntaxhighlighter3_syntax::handle($match, $state, $pos, &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /home/homeatlast2/www/manual/mallassist/lib/plugins/syntaxhighlighter3/syntax/syntax.php on line 53

Warning: Declaration of syntax_plugin_syntaxhighlighter3_syntax::render($mode, &$renderer, $data) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /home/homeatlast2/www/manual/mallassist/lib/plugins/syntaxhighlighter3/syntax/syntax.php on line 82

Warning: Cannot modify header information - headers already sent by (output started at /home/homeatlast2/www/manual/mallassist/lib/plugins/syntaxhighlighter3/syntax/syntax.php:147) in /home/homeatlast2/www/manual/mallassist/inc/actions.php on line 38

Warning: Cannot modify header information - headers already sent by (output started at /home/homeatlast2/www/manual/mallassist/lib/plugins/syntaxhighlighter3/syntax/syntax.php:147) in /home/homeatlast2/www/manual/mallassist/lib/tpl/dokuwiki/main.php on line 12
iframeの高さを自動で調整する [モールアシストマニュアル]

サイドバー

トライアルガイド

スタートアップガイド

基本機能

設定・ご契約について

便利なTips

サポート

テンプレート

iframeの高さを自動で調整する

iframeの高さを自動で調整する

モールアシストで作成したiframeの高さを自動で調整したい場合は、

以下のjavascriptを、iframeを呼び出している親ページに埋め込んでください。
(要jQuery、楽天GOLD及びYahoo!トリプルのスペースで有効)

jQuery(function($) {
 
 function JSON_parse( arg ) {
  if( typeof arg !== 'string' ) return false;
  try {
   return (!JSON) ? eval('(' + arg + ')') : JSON.parse(arg);
  } catch (e) {
   return false;
  }
 };
 
 $(window).on('message', function(e) {
  var json = JSON_parse( e.originalEvent.data );
  if( ! json || ! json.id || ! json.height ) return false;
  $('iframe').each(function(i) {
   var $this = $(this);
   var src = $this.attr('src');
   if( ! src ) src = $this.data('src');
   if( src.match(new RegExp('#!id=' + json.id + '$')) ) $this.height( json.height );
   if( src.match(new RegExp('index_' + json.id + '.html')) ) $this.height( json.height );
  });
 });
 
});


ページ用ツール