Custom HTML Blocks

By tsangktsangk

Description

Since the introduction of [[html]] blocks, users have been able to easily embed external web content easily. The following Javascript code captures HTML blocks' ability to automatically resize itself, allowing any iframed code blocks to be resized automatically too!

Code


The following code goes into the code block:
<!-- Insecure Version -->
<script type="text/javascript" src="http://snippets.wdfiles.com/local--code/code:custom-html/1"></script>
<!-- HTTPS Version -->
<script type="text/javascript" src="https://snippets.wdfiles.com/local--code/code:custom-html/1"></script>

The following code is required to embed the code block:

[[embed]]
<iframe src="http://link.to.codeblock/example.html#/enterUniqueStringHere" class="html-block-iframe"></iframe>
[[/embed]]

Please note, the following are required:

  • append the source URL with a forward-slash, followed by a unqiue string or ID
  • set the class to "html-block-iframe"

In action

Coming soon…


Thanks to tsangk for this great snippet: conditional-blocks


text above inserted with:

[[include :snippets:if START |unique=1|type=equal|var1=%%name%%|var2=conditional-blocks]]
**##red|Thanks to tsangk for this great snippet:##** [[[code:conditional-blocks]]]
[[include :snippets:if END]]



Other snippets posted by tsangk

URL Title with Slash Redirect - 04 Jan 2018 11:32
404 (Page does not exist) Redirect - 20 Nov 2012 11:40
Syntax Highlighter - 16 Feb 2012 01:45
Conditional Blocks - 15 Feb 2012 00:36


Rate this solution

If you think this solution is useful — rate it up!

rating: +1+x
Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License