Results 1 to 5 of 5

Thread: Image Thumbnail Viewer II help

  1. #1
    Join Date
    Jul 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Image Thumbnail Viewer II help

    Well, i've looked through tons of different threads about this, but yet to see my question.

    1) Script Title: Image Thumbnail Viewer II

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...thumbnail2.htm

    3) Describe problem: It's not exactly a problem, but more of asking for help...

    LINK TO THE PAGE: http://users.adelphia.net/~jborgerding/Home.htm
    (click the "9:00" thing located at the bottom footer)

    The code is working great, loving everything it does, BUT! I would like to know a way, (if possible) to have it load the last image you viewed. Currently I have it where you have click it to show up, instead of just scrolling over. anyways. I just want it to have the initial image the last one you clicked. Is there a different code I should use that would be more effective? or is this the right one.

    Thanks for the help... sorry if it's a tad bit confusing.

    EDIT: Something like a cookie.
    Last edited by Yowhatever; 07-27-2006 at 03:47 AM.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    First off, if you are going to do this onclick, use return false:

    HTML Code:
    <a href="#" onClick="modifyimage('dynloadarea', 1);return false;">
    That way the page won't reload every time to 'pagename'#. OK, to use a cookie, you can add this (cookie unit courtesy of quirksmode.org) and onload function to the end of the script:

    Code:
    function createCookie(name,value,days)
    {
    	if (days)
    	{
    		var date = new Date();
    		date.setTime(date.getTime()+(days*24*60*60*1000));
    		var expires = "; expires="+date.toGMTString();
    	}
    	else var expires = "";
    	document.cookie = name+"="+value+expires+"; path=/";
    }
    
    function readCookie(name)
    {
    	var nameEQ = name + "=";
    	var ca = document.cookie.split(';');
    	for(var i=0;i < ca.length;i++)
    	{
    		var c = ca[i];
    		while (c.charAt(0)==' ') c = c.substring(1,c.length);
    		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    	}
    	return null;
    }
    
    function eraseCookie(name)
    {
    	createCookie(name,"",-1);
    }
    onload=function(){
    var sdex=readCookie('idex')
    if (sdex)
    modifyimage('dynloadarea', sdex)
    }
    And, add this line (red) to the modifyimage() function:

    Code:
    function modifyimage(loadarea, imgindex){
    if (document.getElementById){
    createCookie('idex', imgindex)
    var imgobj=document.getElementById(loadarea)
    if (imgobj.filters && window.createPopup){
    imgobj.style.filter=filterstring
    imgobj.filters[0].Apply()
    }
    imgobj.innerHTML=returnimgcode(dynimages[imgindex])
    if (imgobj.filters && window.createPopup)
    imgobj.filters[0].Play()
    return false
    }
    }
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jul 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default i'm positive...

    I'm positive it's just me, but It appers to not be working..?

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Well, I just checked your demo page and it hasn't changed. I can't tell what the problem is if I cannot see what you did. I made a local copy here and it did work by the way.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Jul 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    okay my bad, I took all the stuff off because I wanted to start over, and had to leave...

    anyways... check now, I updated it. Thanks!

    EDIT: YOU ARE A GOD RIGHT NOW (in my mind... =P)

    Thanks you soooooo much!!!!!! It works great!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •