简体   繁体   中英

Skel js called in head does not always load in sharepoint 2013 master page

I'm building a responsive website from the ground up for use as a SharePoint 2013 masterpage, using skel.js to control the grid and breakpoints. Once published, the js files (skel.min.js, skel-panels.min.js, jquery.min.js, html5shiv.js, and a simple config.js written by me to configure skel and skel-panels) do not reliably run every time a user hits the site, leaving the CSS frozen at whatever breakpoint the browser matched at the time. A refresh usually fixes the issue, but that's not an acceptable solution. So far this happens in IE, Chrome and FF (all versions that don't trigger html5shiv).

<!--SPM:<SharePoint:ScriptLink language="javascript" ID="scriptLink1" name="~SiteCollection/Style Library/js/jquery.min.js" runat="server" Localizable="false"/>-->
<!--SPM:<SharePoint:ScriptLink language="javascript" ID="scriptLink2" name="~SiteCollection/Style Library/js/skel.min.js" runat="server" Localizable="false"/>-->
<!--SPM:<SharePoint:ScriptLink language="javascript" ID="scriptLink3" name="~SiteCollection/Style Library/js/skel-layers.min.js"  runat="server" Localizable="false"/>-->
<!--SPM:<SharePoint:ScriptLink language="javascript" ID="scriptLink4" name="~SiteCollection/Style Library/js/jquery.dropotron.min.js"  runat="server" Localizable="false"/>-->
<!--SPM:<SharePoint:ScriptLink language="javascript" ID="scriptLink5" name="~SiteCollection/Style Library/js/jquery.scrolly.min.js"  runat="server" Localizable="false"/>-->
<!--SPM:<SharePoint:ScriptLink language="javascript" ID="scriptLink10" name="~SiteCollection/Style Library/js/init.js" runat="server" Localizable="false"/>-->

Please help, I have been struggling to get right since last few days.

It sounds like it is a timing issue. Your script is probably loading too early sometimes, so it doesn't work. I don't know much about skel (I found this post looking for more info about it), but you might be able to use a setTimeout to delay loading in your init.js file and see if that's what's wrong.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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