View Full Version : Turn persistence OFF ??

06-21-2008, 02:35 PM
1) Script Title: Featured Content Slider v2.3

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/featuredcontentslider.htm

3) Describe problem:

Hello, I presume that turning persistence OFF is what would make it so that slide1 shows on every page refresh. How do I do this? The additional problem I have is that I am calling the content slide script a bit differently (the old way I think) because the {} characters in the new way are causing errors in my script (phpfox). The module or page I install it on just dies if I put it in. Anyway, this is how I currently have it.

<script type="text/javascript">
ContentSlider("slider3", false)
ContentSlider("toc", markup)

I don't even know if the toc markup I have there is doing anything but the slider is working the way I want it to at the moment. I'll include a link to that page .. just keep in mind it's a dev page and looks like a mess :)


Thank you very much for your time.

06-21-2008, 06:00 PM
If the code is written properly, {} will not break it or other properly written code. To turn off persistence, in the script itself edit:

//** Featured Content Slider script- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com.
//** May 2nd, 08'- Script rewritten and updated to 2.0.
//** June 12th, 08'- Script updated to v 2.3, which adds the following features:
//1) Changed behavior of script to actually collapse the previous content when the active one is shown, instead of just tucking it underneath the later.
//2) Added setting to reveal a content either via "click" or "mouseover" of pagination links (default is former).
//3) Added public function for jumping to a particular slide within a Featured Content instance using an arbitrary link, for example.

var featuredcontentslider={

//3 variables below you can customize if desired:
ajaxloadingmsg: '<div style="margin: 20px 0 0 20px"><img src="loading.gif" /> Fetching slider Contents. Please wait...</div>',
bustajaxcache: true, //bust caching of external ajax page after 1st request?
enablepersist: true, //persist to last content viewed when returning to page?

settingcaches: {}, //object to cache "se . . .

Make it:

enablepersist: false,

06-21-2008, 07:27 PM
Thank you John.. I very much appreciate your time. I have set that to false and it seems to continue to persist. Is it possible that the script is cached and it just needs to work out? I cleared my browser cache, so not really sure what could be going on.

** Not sure why those {} tags are killing phpfox. Pretty popular script. I guess I'll have to contact the developer. **

06-21-2008, 08:30 PM
I forgot that I was using smarty tags and had to {literal} it. So I figured that out.. but I haven't determined why the persistence issue isn't working. Persistence is only a global setting? Can you set it per slider if you are using more than one?

Thanks again for your time. It's much appreciated.

06-22-2008, 01:11 PM
OK, I set up a demo here and the persist/not persist thing worked fine for me in several browsers. So, unless one of your other scripts is interfering with that, it should work for you. Or, the script may be cached. Clear your browser's cache and try again.

Now, if you would like to be able to set persistence on a slider by slider basis, use this contentslider.js file:


It no longer has a setting for enablepersist. That is now set (in the on page call) for each slider, ex:

<script type="text/javascript">

id: "slider1", //id of main slider DIV
contentsource: ["inline", ""], //Valid values: ["inline", ""] or ["ajax", "path_to_file"]
toc: "#increment", //Valid values: "#increment", "markup", ["label1", "label2", etc]
nextprev: ["Previous", "Next"], //labels for "prev" and "next" links. Set to "" to hide.
revealtype: "click", //Behavior of pagination links to reveal the slides: "click" or "mouseover"
enablefade: [true, 0.2], //[true/false, fadedegree]
autorotate: [true, 3000], //[true/false, pausetime]
enablepersist: true, //true/false - defaults to false
onChange: function(previndex, curindex){ //event handler fired whenever script changes slide
//previndex holds index of last slide viewed b4 current (1=1st slide, 2nd=2nd etc)
//curindex holds index of currently shown slide (1=1st slide, 2nd=2nd etc)


09-03-2008, 06:59 PM
John, Thanks for your input here. I integrated your change into Featured Content Slider 2.4.

As a note to potentially help others who use the Featured Content Slider in multiple locations on their website. I was interested in finding out how to turn persistence off because I was having a problem with the content slider freezing and requiring a page refresh. It was caused by using the content slider on separate pages for different sets of images.

Here is what was happening: I would navigate to the page with the first set of images, view those 9 images and then navigate to the page with a different set of 4 images. The first image in the second set would appear but would not transition to the next image nor allow me to select an image from the pagination bar. If I refreshed the page then it would begin working.

Here is the problem: I found that if the last image that I looked at in the first set of images was greater than the total number of images in the second set of images the problem occured. For example, if I looked at the 5th image last in the first set of images and then went to the second set of 4 images it froze. This is because it persisted image 5 and could not find it because there are only 4 images in the second set.

Solution: I turned of persistence