SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Having trouble with an image popup

    I'm just getting my feet wet with javascript and jquery and am trying to build a site for my cousin for practice.

    When I click image thumbnail my script seems to work fine then I click another and it works fine again...but when I keep clicking it seems to bog down and not display the popup images right away and when they finally do come up the fade in and out for however many times I click trying to get it to pop up.

    I put the site here so you can see what I mean:

    http://vanamp.netii.net/Art/Travels.html

    Code JavaScript:
    //* Javascript Document
     
     
    $(document).ready(function()
    {
     
     
     
    	$('.elastislide-list li a img').click	(function(){
    		var target = $(this).attr("data-large");
    		if($('.photoView'))
    		{
    		$('.photoView').addClass('displayNone').removeClass('photoView');
     
     
     
    			$('.backdrop, .lightBox').animate({'opacity':'.50'}, 300, 'linear');
    					$('.lightBox').animate({'opacity':'1.00'}, 300, 'linear');
    					$('.backdrop, .lightBox').css('display', 'block');
    			                document.getElementById(target).setAttribute('class', 'photoView');
     
     
     
    			$('.close').click(function(){
    					close_box();
    				});
     
    				$('.backdrop').click(function(){
    					close_box();
    				});
     
     
     
    			function close_box()
    			{
    				$('.backdrop, .lightBox').animate({'opacity':'0'}, 300, 'linear', function(){
    					$('.backdrop, .lightBox').css('display', 'none');
    					$('.photoView').addClass('displayNone').removeClass('photoView');
    				});
    			}
     
     
    		}
    	});
     
    });


    Like I said I am just beginning to learn this so hopefully my code is not too offensive

    any help is appreciated

    Thanks

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,198
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    Hi vanamp. Welcome to the forums.

    Quote Originally Posted by vanamp View Post
    I put the site here so you can see what I mean:

    http://vanamp.netii.net/Art/Travels.html
    It's not really clear what we are meant to click on there. It's just a black page with a few links that don't go anywhere.

  3. #3
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well then, it looks like I have another problem to figure out. there should be a scrollbar of images on the bottom to click on let me re work it and see if I can get it working.

  4. #4
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,198
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    OK, I had another look, and left the page open for a while, and suddenly it appeared at the bottom, but it takes quite a while to show up. It might be worth checking out other galleries. I really like Slimbox2.

  5. #5
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I love the slimbox. I had some issues using it with latest jquery 1.9 but found a fix here:

    http://code.google.com/p/slimbox/issues/detail?id=36

    thank you for this.

  6. #6
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I thought I was home free then I tested it in IE 9 and I just get a blank white box. is there anything like slim box that works with IE 9

  7. #7
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,198
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    Is it possible for you to use an earlier version of jQuery? That's the easiest solution.

  8. #8
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried switching jquery versions and have not found one that works in IE 9. I click an image the box comes up without the image and I can use the NEXT button and box resizes itself to the proper dimensions for the next image but still remains blank.

    Everything works great when I test in IE 8

  9. #9
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,198
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by vanamp View Post
    I can use the NEXT button and box resizes itself to the proper dimensions for the next image but still remains blank.
    O, in that case it sounds like there's a problem with your image paths, rather than an issue with jQuery. The links to your large images may be wrong. Check that they are actually pointing the location of the images. If you post a live link, we can check for you.

  10. #10
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hooray! I uploaded site so I could link it for you and it seems to be working just fine on the server. It just was not working locally...no idea why though?!?!

  11. #11
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,938
    Mentioned
    214 Post(s)
    Tagged
    12 Thread(s)
    Hi,

    You are including jQuery twice in your page - once in line 13 and once in line 128.
    Maybe this had something to do with it.

    You should remove one of these versions by the way. Probably the older version (1.8.2)

  12. #12
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,198
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by vanamp View Post
    Hooray! I uploaded site so I could link it for you and it seems to be working just fine on the server. It just was not working locally...no idea why though?!?!
    I still see the old page in the link you first posted.

    Anyhow, depending on how you have set up the links, they may need to be different on your local machine unless you have a server environment set up.


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
  •