将外部帖子/内容加载到特定的div(jquery,wordpress) [英] Loading external post/content to a specific div (jquery, wordpress)

查看:123
本文介绍了将外部帖子/内容加载到特定的div(jquery,wordpress)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在玩一个网格化的主题,发现了一些非常酷的网站,类似于主题:
ex。 http://home.visuaal.com/



<问题是:关于如何加载帖子内容的想法与上面的示例相似?



当用户点击每个框时,特定div展开并显示/加载整个帖子。点击关闭按钮后,该框会恢复到正常状态。



我一直在弄清楚如何从帖子的永久链接中获取内容并将其放置在框。我也通过大量的jquery脚本进行了搜索/实验,但没有成功使它们能够与wordpress一起使用。

如果你知道要将数据加载到您的div可以使用加载函数。要显示和隐藏div,您可以使用各种效果功能之一。



例如:

  $(#your_div)。load('/ post_url' ,function(){
$(this).slideDown()。click(function(){
$(this).slideUp(); //隐藏任何点击 - 您可以将选择器更改为满足您的需求。
});
});


I've been playing around with the grid-a-licious theme, and found some really cool sites similar to the theme: ex. http://home.visuaal.com/

The question is: any idea on how the post contents were loaded similar to the sample above?

When the user clicks on each box, the specific div expands and displays/loads the entire post. When the close button is clicked, the box returns to its normal state.

I've been figuring out how to grab the content from the post's permalink and place it in the box. I've also searched/experimented through a lot of jquery scripts but no success to make them work with wordpress.

解决方案

If you know the div that you want to load data into you can use the load function. To show and hide the div you can use one of the various Effects functions.

For example:

$("#your_div").load('/post_url', function() { 
  $(this).slideDown().click(function() { 
    $(this).slideUp();  // hide on any click - you can change the selector to suit your needs.
  });
});

这篇关于将外部帖子/内容加载到特定的div(jquery,wordpress)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆