简体   繁体   English

加载的AJAX内容突破了DIV标签

[英]Loaded AJAX content breaking out of DIV tag

Hi. 你好 I'm new to Java/AJAX etc. I have a page with links down the left and a DIV on the right. 我是Java / AJAX等的新手。我有一个页面,其左侧为链接,右侧为DIV。 I want content (other pages) to load in the DIV when users click on the links on the left... beginner AJAX stuff I guess. 当用户单击左侧的链接时,我希望内容(其他页面)加载到DIV中……我想是初学者AJAX的东西。

I played around with a few JQery plugins and found one that allows pages to load with a fade effect, which is perfect. 我玩了几个JQery插件,发现一个插件可以使页面以淡入淡出效果加载,这是完美的。 I have a problem though: 我有一个问题:

The plugin works fine when I click links on the parent page, but when I click links in one of the loaded pages, after one link deep, it breaks out of the div and replaces my parent page. 当我单击父页面上的链接时,该插件运行良好,但是当我单击已加载页面之一中的链接时,在一个链接较深之后,它会脱离div并替换我的父页面。 (This issue was described on the plugin page, supposedly solved, but is still cropping up on my page). (此问题已在插件页面上进行了描述,应该可以解决,但仍在我的页面上出现)。 I suspect it has something to do with the "bind" variable. 我怀疑这与“绑定”变量有关。

I've uploaded a stripped down example of my site here : This is the plugin website: www.thecreativeoutfit.com/index.php?view=Simple-AJAX-Content-Changer-with-EZJax (Because I'm a new user I can't add any more links, sorry for the long-hand). 我上传我的网站的精简例子在这里 :这是插件网站:www.thecreativeoutfit.com/index.php?view=Simple-AJAX-Content-Changer-with-EZJax(因为我是新用户我无法再添加任何链接,对于长期的工作,我们深表歉意。

For those who are willing to look at my site or the plugin, I'd appreciate your insight. 对于那些愿意查看我的网站或插件的人,我将不胜感激。 If that's a hassle maybe you could recommend a similar simple ajax plugin that allows the loading of content with a fade-in effect, but also allows links within the loaded content to stay contained within the original div. 如果这很麻烦,您可能会推荐一个类似的简单ajax插件,该插件允许以淡入效果加载内容,但也允许加载的内容中的链接保留在原始div中。

Many thanks! 非常感谢!

Max 最高

I was going to post a comment but it got too long so, what the heck.. 我本来要发表评论,但时间太长了,这到底是什么。

Your website worked just fine for me (except for the pages that were not available) in Firefox running on Windows XP. 在Windows XP上运行的Firefox中,您的网站对我来说很好(除了不可用的页面除外)。

However, I would strongly recommend against that type of design - it will be a pain for you to maintain in the long run and it is generally considered bad design because it is against the functioning principles of the web: different pages of your website should be represented by distinct URLs which users of your site could use to link to. 但是,我强烈建议您反对这种类型的设计-从长远来看,这将使您难以维持,并且通常被认为是不好的设计,因为它违反了网络的运作原理:网站的不同页面应由您网站的用户可以用来链接的不同URL表示。 It also breaks browser back button functionality which is a big usability issue (at least for me). 它还破坏了浏览器的后退按钮功能,这是一个很大的可用性问题(至少对我而言)。

Plus, it will not be SEO friendly - which means that search engines like Google won't think highly of your website - which means that you won't show up in searches. 此外,它不会是搜索引擎友好的-这意味着,像谷歌搜索引擎不会看得起你的网站-这意味着你不会在搜索中显示出来。

您嵌套的页面中断了,因为在第一页导致正常的href属性被使用之后,JavaScript click事件没有重新附加到分页控件上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM