zutrinken / bleak

Ghost Theme
https://bleak.peteramende.de
MIT License
535 stars 130 forks source link

Javascript not loading on initial load #16

Closed munishis closed 8 years ago

munishis commented 8 years ago

Please check my site at http://careevidence.com and try first post on the eyecare of patients with diabetes. When you first click the post, the javascipt with PDF in it doesn't load but on page refresh it shows up. Great theme, love it. Thanks for great work.

munishis commented 8 years ago

Just in case you are wondering what script I am referring to here is link to it.

<div id="publitas-embed-loz3nsj1m2">
</div>
<script publitas-embed 
       data-wrapperId="publitas-embed-loz3nsj1m2" 
       data-cfasync="false" 
       data-menu="false" 
       data-publication="https://view.publitas.com/careevidence-com/eyecare-of-the-patient-with-diabetes-mellitus/" 
       data-responsive="true" 
       type="text/javascript" 
       src="https://view.publitas.com/embed.js"></script> 
zutrinken commented 8 years ago

hmm, not sure about this embed stuff, but of course all the JS scripts have to be initialized after every page change because of the ajax stuff. There is a function in the script.js only for reloading all them. Maybe it helps if you add their embed.js manually to the theme, but I'm not sure. Isn't there any other embed solution, like a plain iframe code like YouTube for example handles it?

moeenxyz commented 4 years ago

Hello I have the same problem. I use a .js file to stick the navbar to top after scroll, but when pages load via ajax, it doesn't work.

zutrinken commented 4 years ago

@msilight same for you. All functions have to be reloaded here.

moeenxyz commented 4 years ago

@msilight same for you. All functions have to be reloaded here. Thanks for the quick replay: My function is:

window.onscroll = function() {stickynav()};

var navbar = document.getElementById("nav"); var sticky = navbar.offsetTop;

function stickynav() {
  if (window.pageYOffset >= sticky) {
    navbar.classList.add("stickynav")
    navbar.classList.remove("navbottom")
  } else {
   navbar.classList.add("navbottom")
    navbar.classList.remove("stickynav");
  }
}

i try ti change the relaod function like this:

function reload() {
        grid();
        ajaxLinkClass();
        highlight();
        gallery();
        video();
        comments();
stickynav();
    }

but it doesn't work.

moeenxyz commented 4 years ago

Hello @zutrinken Can you please help me, I can't figure this out!