jquery load issue

后端 未结 2 1705
日久生厌
日久生厌 2020-12-09 23:30

I\'m loading pages asynchronously with the jQuery load function, like this:

tree.click(function() {
                if ($(this).hasClass(\"file\")) {
                


        
2条回答
  •  醉话见心
    2020-12-09 23:50

    SyntaxHighlighter.all ties into the window.onload event - which only fires once.

    To syntax-highlight after the page loads, use the highlight function instead:

    content.load("content/"+this.id+".html", function () {
      // this is executed after the content is injected to the DOM
      contentContainer.effect("highlight");
      SyntaxHighlighter.highlight();
    });

    Fingers crossed that works, if not (based on looking at the code) you might need to chuck in some explicit arguments (where {} is an empty set of configuration parameters, and this will be content when called from the ajax load handler):

    
      SyntaxHighlighter.highlight({}, this);
    

提交回复
热议问题