简体   繁体   English

CSS样式表未在链接页面上加载

[英]CSS stylesheet not loading on linked page

I have a site that has multiple pages. 我有一个包含多个页面的网站。 The first page is just a listview with icons and links to the other pages. 第一页只是一个带有图标和指向其他页面的链接的列表视图。 CSS stylesheets work fine on the first page, but when I go to one of the linked pages, my custom css stylesheet (and js for that matter), related to that page, is being ignored. CSS样式表在第一页上工作正常,但是当我转到其中一个链接的页面时,与该页面相关的自定义CSS样式表(与此相关的js)将被忽略。 If I look in the FF inspector I see that it has dropped the associated lines that tell it about my stylesheet. 如果我在FF检查器中查看,就会发现它已经删除了相关的行,以告诉我有关样式表的信息。 If I directly go to the desired page or if I hit refresh, the styles look fine, but whenever I come from a link off the first page, the styles are gone. 如果直接进入所需页面,或者单击刷新,样式看起来就很好,但是只要我来自第一页的链接,样式就消失了。 I see no errors when loading the page. 加载页面时没有看到错误。 Is this a know issue? 这是一个已知问题吗? How can I force it to not ignore my stylesheets. 如何强制它不要忽略我的样式表。

I am using jquery mobile 1.4.5 in addition to my own. 除了我自己的以外,我还在使用jquery mobile 1.4.5。

Looking further. 进一步看。 It looks like hitting the link is appending the body of the 2nd page at the end of the first and not simply loading the 2nd page. 看起来点击链接是将第二页的正文附加在第一页的末尾,而不是简单地加载第二页。

It turns out that by default links behave a little different than normal when using jQuery Mobile. 事实证明,使用jQuery Mobile时,默认情况下链接的行为与常规行为有所不同。 The don't do a full page load, but instead only inject the part contained in a div marked with data-role="page". 不要执行整个页面加载,而是仅注入div中包含data-role =“ page”标记的部分。 I did not know this. 我不知道这个。

http://demos.jquerymobile.com/1.1.1/docs/pages/page-links.html http://demos.jquerymobile.com/1.1.1/docs/pages/page-links.html

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

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