【问题标题】:Pulling HTML content using ajax in wordpress post在 wordpress 帖子中使用 ajax 提取 HTML 内容
【发布时间】:2014-06-19 20:44:26
【问题描述】:

好的,我目前正在开发一个网站,我想在每个帖子中嵌入一个时间线。我正在使用 WordPress。我插入的时间线会因帖子而异,所以这个时间线不能插入到我正在使用的实际主题中?我对 PHP、HTML 和 JS 也很陌生。但是我已经搜索了很多论坛并且无法为我的生活弄清楚如何做到这一点。无论如何,这是我的时间线的链接。 http://derikgrass.com/timeline/xml/2012-2014/pbj/index.html

这里是使用 iFrame 嵌入到我的网站上的时间线的链接。 http://www.derikgrass.com/events/?p=526

iFrame 的效果很好,只是 iframe 需要比时间线本身大得多,因为当您单击时间线中的事件时时间线会延伸,正如您从我提供的链接中看到的那样。这是时间轴的 html 代码:

<meta charset="utf-8">


<title>TimelineXML</title>
<meta name="description" content="">


<link rel="stylesheet" href="css/timelinexml.sleek.css">

    <section class="demo">
        <p> <br/><br/> </p>
        <div class="demo-box">
        <div id="my-timeline">
            <div class="timeline-html-wrap" style="display: none">



            </div>
            </div>
        </div>
    </section>

</div>



<!-- JavaScript at the bottom for fast page loading -->

<!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.1.min.js"><\/script>')</script>


<!-- scripts concatenated and minified via build script -->

<script defer src="js/mylibs/timelinexml.js"></script>
<script defer src="js/script.js"></script>
<!-- end scripts -->

我想将其直接嵌入到我创建的特定帖子中。如果有人能够帮助我编写代码以嵌入此时间线,我将非常感激。谢谢。

【问题讨论】:

    标签: javascript php html css ajax


    【解决方案1】:

    我认为你的意思是你只是想把他放在你的html中

    <iframe src="http://derikgrass.com/timeline/xml/2012-2014/pbj/index.html" scrolling="no" height="400" width="900"> </iframe>
    

    并改变宽度。

    但是你应该去源头(所以点击那个链接),你会看到他使用了一个很好的 js 文件来使它工作。如果你这样做,你会看到他正在使用这个脚本:

    http://codecanyon.net/item/jquery-timelinexml/1448100

    我不喜欢那里的脚本,因为我认为它们是时髦的网站,但是嘿,这是您的计算机和服务器。由你决定。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-11-23
      • 1970-01-01
      • 2015-06-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-19
      • 2021-12-05
      相关资源
      最近更新 更多