C5 Image Slide Show only shows when in Edit Mode

Permalink 1 user found helpful
I added a static image, and it shows fine, but when I add a file set, or a custom set of images, the slide show only works when in edit mode, but then when I preview or publish, it disappears.

Deladroid
View Replies:
JohntheFish replied on at Permalink Reply
JohntheFish
It may be that you are looking at a cached page rather than the page you have edited.

In C5, go to the dashboard, sitewide settings, bottom right (ish) panel and clear the cache (and maybe turn it off while you are developing).

You may also have a page sticking in the browser cache or on a proxy server; that all depends on your browser settings and how your ISP provides your internet connection (though current browsers are pretty good at knowing when to update, a few years back they could be very stubborn).

Another possibility is that javascript for the gallery is only being loaded in edit mode. An easy way to check is to view source in both edit mode and normal display and see if the gallery script is running.

A final possibility is that another block on your site is also loading the same script, perhaps under a different name. Using firebug or other developer options, look at the javascript console for an error message along the lines of 'function xx is already defined'. The popup login is a component that can introduce this issue only when you view a page. In this case you will need to disable the loading of the duplicated script.
Deladroid replied on at Permalink Reply
Deladroid
I have script checking if in Edit Mode, and only referencing a JQuery Carousel file (for horizontal text marquee) if not in edit mode. So does this mean C5 is already importing a carousel script? That's the only thing I can think of-- that it's conflicting or doubling up.
JohntheFish replied on at Permalink Reply
JohntheFish
Maybe, either carousel or something used by carousel. Its worth doing a quick view source and looking through the files to see if there is anything obvious, then look for script errors being shown in a firefox or chrome developer console or firebug console.

Another thought, could there be an error in the non-edit mode part of your own javascript?
Deladroid replied on at Permalink Reply
Deladroid
I figured it out! It may have been one or both of these, but I moved the script function out of the head, and down to the div where the jquery carousel is, and I also removed the line $(document).ready(function(). It's working now.
DominicWhiteStudio replied on at Permalink Reply
DominicWhiteStudio
I am having the same problems with my layout and slideshows only showing up in edit mode. It looks like you've figured it out, but this thread is completely over my head. Anyway you can dumb it down a bit for us non-programmer types?
Deladroid replied on at Permalink Reply
Deladroid
I had a script in the <head> area, and when I moved it to the <body> under the <div> tag where the "carousel" scroller I'm using is, it started working. Within that same script, there was a line of code "$(document).ready(function()" which I removed, because it didn't work with it in. I'm fairly a newbie with javascript and jquery.
JohntheFish replied on at Permalink Reply
JohntheFish
"$(document).ready(function()" is the jQuery way of making sure a script does not execute until the page is sufficiently loaded that everything the script needs is there (which amounts to the html and other scripts).

Without "$(document).ready", a script could be executed as soon as the browser sees it in the document.

I cant tell you why "$(document).ready(function()" was not running, though a likely reason is a faulty loading of jQuery (perhaps a double loading). So in your first stage of removing it and leaving your script in the head, the script may have been failing because it was running too soon. Your second stage, moving the script to the document body, has delayed the scripts execution a little bit until everything is in place.

BUT (and its a BIG BIG BUT), you cannot depend on this. Slightly different timings of downloads from the server, or a different browser or browser version, or adding another block that uses jquery or javascript to the page, or moving from a development server to an online server, all change the background in which your script is executing. It may still work, or it may not.

You really need to look at the page loading with the developer console or firebug open and find out why "$(document).ready was not running. A possible candidate is that you were loading jQuery or another script more than once and so the second time resulted in a double declaration error, thus preventing further javascript from running.

Failing that, you could use a regular javascript window.onload or document.onload event handler to start your script.

(but you would still be fixing the symptom rather than the root cause)
Deladroid replied on at Permalink Reply
Deladroid
Great points. You're right. I'm going to use Google Chrome's javascript console and see what I find. Thanks.
FullLifeConcrete5 replied on at Permalink Reply
FullLifeConcrete5
Hello, John--

I am a novice. I looked up this problem because my blog page is only showing when I am in edit mode.

I cleared my cache and that didn't enable my blog page to appear in normal mode.

So then it seems the next step is to compare the source code in edit and regular mode...but I can't see the source code in regular mode, since i can't see the page in regular mode.

Also, I want to know please, what words of code am I specifically looking for?

I'd sure appreciate your response on this...I am stymied. Thanks ~~
FullLifeConcrete5 replied on at Permalink Reply
FullLifeConcrete5
I did look for: $(document).ready(function()

and I found this:


$(document).ready(function(){
imgLoader = new Image();// preload image
imgLoader.src = jQuery.fn.dialog.loaderImage;


But I couldn't try deleting it until I said I wanted to edit it, and then a whole different set of code was visible, and I could no longer find what I saw before (above) anywhere.

Help will be appreciated.
Deladroid replied on at Permalink Reply
Deladroid
The problem I had was a jquery reference that didn't need there because of the jquery references C5 already loads, which causes conflict. I don't have an answer for you as I/we'd have to see your code, but I recommend going to your html and looking at your javascript references, particularly any jquery references.
JohntheFish replied on at Permalink Reply
JohntheFish
I suspect that your problem is completely unrelated. It would probably be best to start a new topic.
weyboat replied on at Permalink Reply
weyboat
Check to see if you have given the permissions for the page to be read by guests etc..
FullLifeConcrete5 replied on at Permalink Reply
FullLifeConcrete5
For some reason, the page appeared to the casual downloader recently...though I hadn't been making any administrative changes at all.

I did go in to see if there were access restrictions to the blog page, did not find any, and am not even familiar with how to create such a thing.

Is the fact that this happened mean that Concrete 5 is unstable?
weyboat replied on at Permalink Reply
weyboat
Does the page disappear after to exit edit mode or when you log out?
catirebcn replied on at Permalink Reply
catirebcn
I was having the same problem with a Nivo slider only showing in edit mode. The problem was solved by simply uploading the images using the file manager in the dashbord.
Hope this helps people with the same issue.

Rei
waroly replied on at Permalink Reply 1 Attachment
I am having exactly the same problem. My very basic Concrete5 slideshow shows up while I am signed in as an admin. As soon as I sign out, it disappears. I am attaching my code. If someone could take a look, I would appreciate it.

Waroly
jero replied on at Permalink Reply
jero
I think I've answered this for on this thread:

http://www.concrete5.org/community/forums/usage/slideshows-disappea...