Facebook FBML 问题
我有一位客户希望创建一个与 http://www.facebook.com/enchantment
在“附魔”页面中,您可以看到有一个子选项卡列表,“附魔、简介、摘录、订单”。我想创造相同的风格,但我似乎不知道如何做。我查看了代码,看起来他们正在使用“FBML Static”应用程序作为主选项卡,并且有大量的 javascript 来显示和隐藏选项卡,我非常怀疑这些选项卡都是手工编写的。
有人有这方面的经验吗?提前致谢。
I have a client looking to create a Facebook page very similar to http://www.facebook.com/enchantment
Inside the "Enchantment" page, you can see that there is a list of sub-tabs, "Enchantment, Blurbs, Excerpts, Order". I'm looking to create the same style, but I can't seem to figure out how. I've looked through the code and it appears they're using the "FBML Static" application for the main tab, and there's a ton of javascript to show and hide the tabs that I highly doubt was all written by hand.
Does anybody have any experience with this? Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您必须通过开发人员页面中的“我的应用程序”链接创建 Facebook 应用程序。填写完所有字段后,您的应用程序页面应该启动并运行。
现在您需要开始在您的网站上开发实际的应用程序(您必须在应用程序设置中指定链接)。仔细阅读开发人员文档,因为他们有非常好的文档。
因此,为了实际创建这些选项卡,实际上非常简单,您所要做的就是利用 FBMls
clicktoshow
和clicktohide
属性。基本上,您需要的只是以下代码:当 Facebook“导入”此代码(仅通过 FMBL,我不确定这是否适用于 iframe)时,它会方便地完成所有工作并将上述链接转换为类似以下内容:
但是,您只有不用担心第一部分,因为 Facebook 会处理第二部分。正如您所看到的,这是一个相当简单的过程。
You will have to create a Facebook application via the My Applications link in the developers page. After you have filled in all the of the fields your app page should be up and running.
Now you need to begin developing the actual app on your website (you will have to specify the link in your application settings). Go through the Developer documentation, as they have quite a good documentation.
So, in order to actually create those tabs, its actually very simple, all you have to do is utilize FBMls
clicktoshow
andclicktohide
attributes. Essentially all you need is the following code:When Facebook 'imports' this (only via FMBL, I'm unsure if this works with iframe) it conveniently does all the work and converts the above links to something like:
But, you only have to worry about the first part, as Facebook takes care of the second. As you can see it is a fairly straightforward process.
他们可能只是捕获点击事件,并根据该事件简单地显示和隐藏不同的 div。您可以创建一个静态 FBML 选项卡,并在其中执行类似的操作:
我没有为您创建任何样式,但是上面的代码所做的是隐藏并显示“foo”和“bar”div,具体取决于什么你点击。它还将类名“selected”添加到单击的锚标记中,以便您可以设置一些样式来提供有关当前活动选项卡的视觉提示。您肯定会想添加一些样式来美化它。
我希望这有帮助。
They're probably just capturing the click event, and simply showing and hiding different divs based on that. You can create a static FBML tab, and do something like this inside of it:
I haven't created any styles for you, but what the code above does is it hides and shows the "foo" and "bar" divs depending on what you click on. It also adds the class name "selected" to the anchor tag that was clicked on so that you can set some styles to give a visual cue as to which tab is currently active. You'll definitely want to add some styles to pretty this up.
I hope this helps.
您无法直接看到代码,因为用 FBML 编写的代码在传递到浏览器并转换为 HTML 之前会被 Facebook 解析;这就是为什么你会看到很多 JavaScript。
实际上它看起来并没有那么复杂,所以我相信它实际上是用 JavaScript 手工编写的。
You cannot see directly the code since the code written in FBML gets parsed by Facebook before it's delivered to the browser and transformed into HTML; that's why you see a lot of JavaScript.
Actually it doesn't look so complex so I believe it was actually written by hand with JavaScript.