admin管理员组文章数量:1330393
Currently I have a website hosted on Github Pages that runs on Jekyll with a main index.html file as the homepage that links to pages written in markdown. I got the Fluidbox jQuery plugin to work correctly in HTML but not in my markdown files. I dropped the jQuery code in my footer which is loaded on every page:
<!-- Load jQuery -->
<script type="text/javascript" src=".min.js"></script>
<!-- Load plugins -->
<script type="text/javascript" src=".1/jquery.ba-throttle-debounce.min.js"></script>
<script type="text/javascript" src="./fluidbox/js/jquery.fluidbox.min.js"></script>
<!-- JS Functions -->
<script>
$(function () {
// You can use any kind of selectors for jQuery Fluidbox
$("a[data-fluidbox]").fluidbox();
});
</script>
</footer>
Currently I have a website hosted on Github Pages that runs on Jekyll with a main index.html file as the homepage that links to pages written in markdown. I got the Fluidbox jQuery plugin to work correctly in HTML but not in my markdown files. I dropped the jQuery code in my footer which is loaded on every page:
<!-- Load jQuery -->
<script type="text/javascript" src="https://ajax.googleapis./ajax/libs/jquery/1/jquery.min.js"></script>
<!-- Load plugins -->
<script type="text/javascript" src="https://cdnjs.cloudflare./ajax/libs/jquery-throttle-debounce/1.1/jquery.ba-throttle-debounce.min.js"></script>
<script type="text/javascript" src="./fluidbox/js/jquery.fluidbox.min.js"></script>
<!-- JS Functions -->
<script>
$(function () {
// You can use any kind of selectors for jQuery Fluidbox
$("a[data-fluidbox]").fluidbox();
});
</script>
</footer>
I then use
<a href="path to image" data-fluidbox><img src="path to image" alt="" width="100%" height="auto"/></a>
to implement the plugin's effect on an image. This works in my HTML files not my Markdown files. How can I properly run a jQuery plugin in a Jekyll markdown file?
Share Improve this question asked Apr 17, 2017 at 23:29 Ash BhimasaniAsh Bhimasani 451 gold badge1 silver badge7 bronze badges1 Answer
Reset to default 5You can't run HTML/JS in markdown files, simply because markdown is not actually anything that understands how to run HTML/JS. The only reason your markdown files are rendering correctly is because Jekyll is parsing your markdown files and rendering them as HTML/JS behind the scenes.
If you want to run some HTML/JavaScript whilst having Markdown in some of your files, you are better off having your HTML files rendering markdown snippets and then whatever HTML/CSS/JS you need, you can add those because, well, it's an HTML file. Take a look at how you would embed markdown in an HTML file here.
本文标签: Run JavascriptjQuery in MarkdownStack Overflow
版权声明:本文标题:Run JavascriptjQuery in Markdown - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742233178a2437595.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论