Results 1 to 4 of 4

Thread: Image gallery??

  1. #1
    Join Date
    Feb 2006
    Location
    Sweden
    Posts
    27
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Exclamation Image gallery??

    Hello!!

    I decided I wanted to have this effect on my image gallery:

    http://www.webinventif.fr/wp-content...ts/tooltip/02/

    So, I was following this tutorial:

    http://www.catswhocode.com/blog/how-...ry-with-jquery

    My issue is that the tutorial is not really clear and apparently it has errors. My editing software says that there is a syntax error in

    Code:
    $("a.screenshot").hover(function(e){
                    this.t = this.title;
                    this.title = "";
                    var c = (this.t != "")  ? "
    " + this.t : "";
                    $("body").append("<p id='screenshot'><img src='"+ this.rel +"' alt='url preview' />"+ c +"</p>");
                    $("#screenshot")
                            .css("top",(e.pageY - xOffset) + "px")
                            .css("left",(e.pageX + yOffset) + "px")
                            .fadeIn("fast");
        },
    My editing program says that the error is in:
    Code:
    My editing program says that the error is in: var c = (this.t != "")  ? "
    Another issue that is killing me is that in the tutorial the author says that: "Once you inclued the gallery functions, you have to activate it. Like for the functions, you can embed it on your html page or put it in a separate .js file." - How do I activate it?? Is there an option on the software that I use to do it, like there is for attaching CSS files? Should I just save a separate .js file with the supplied code and the activation is done automatically??

    This is it for now, hope somebody can actually help me out

    Thanks in advance!
    Last edited by jonybigude; 02-13-2012 at 09:31 AM.

  2. #2
    Join Date
    Aug 2011
    Location
    both, Germany and Bulgaria
    Posts
    54
    Thanks
    14
    Thanked 10 Times in 10 Posts

    Thumbs up

    Actually I don't understand the idea behind this statement:
    Code:
    var c = (this.t != "")?("" + this.t):"";
    If I'm interpreting it correctly, it says:
    If "this.t" is not empty, then make "c" equal to "this.t", otherwise if "this.t" is empty, then make "c" also empty.
    I'm sure it would be easier to write directly:
    Code:
    var c = this.t;
    Try it out

    Next issue says to you to include the given lines of text from the tutorial somewhere in your html document (best between the <head> tags), or to put them in a separate .js file, which you have to include again. The activation happens with the call of these three functions, but you don't have to care about it. You don't have to do anything else.

    Quote Originally Posted by jonybigude View Post
    Another issue that is killing me is that in the tutorial the author says that: "Once you inclued the gallery functions, you have to activate it. Like for the functions, you can embed it on your html page or put it in a separate .js file." - How do I activate it?? Is there an option on the software that I use to do it, like there is for attaching CSS files? Should I just save a separate .js file with the supplied code and the activation is done automatically??

    This is it for now, hope somebody can actually help me out

    Thanks in advance!
    Last edited by XManBG; 02-11-2012 at 10:32 PM.

  3. The Following User Says Thank You to XManBG For This Useful Post:

    jonybigude (02-13-2012)

  4. #3
    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

    Code:
                    var c = (this.t != "")  ? "
    " + this.t : "";
    Well there shouldn't be a line break there, it should be:

    Code:
                    var c = (this.t != "")  ? "" + this.t : "";
    or perhaps:

    Code:
                    var c = (this.t != "")  ? " " + this.t : "";
    Which would answer XManBG's question, as it would add a space if this.t is defined. Even without that though, if this.t is a number, doing it like that converts it to a string and to an empty string if this.t is 0. Or if this.t could be null or object even when false or empty, it prevents those from appearing as text in c, as some browsers will otherwise convert them to their string equivalents ('null', or 'object') under certain circumstances.

    In any case, that line break has got to be removed.

    There could also be other problems.

    The browser cache may need to be cleared and/or the page refreshed to see changes.

    If you want more help, please post a link to the page on your site that contains the problematic code so we can check it out.
    - John
    ________________________

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

  5. The Following User Says Thank You to jscheuer1 For This Useful Post:

    jonybigude (02-13-2012)

  6. #4
    Join Date
    Feb 2006
    Location
    Sweden
    Posts
    27
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    Hello all!

    The fact is that after a while looking at his website i found out that he helps out people that PAY!! So, I'm left to conclude that he puts out a lot of nice tutorials there, but with a complicated english to understand, no sample files for download and some bugs on the code, so that people have to pay him to solve those problems!

    Fortunately it's XXI century and there is a vast internet full of solutions and even before I saw your answers I found out this other tutorial WITH sample files to download and no bugs:

    http://cssglobe.com/post/1695/easies...w-using-jquery

    After implemented on the website I found out that it wasn't really what I was hoping for, so I decided to implement this one instead:

    http://fancybox.net/

    Works just fine, and it is really easy to implement. It's exactly what I was looking for!

    Thank you so much all of you that helped me out with your answers, it was really thoughtful! Please keep on helping people like me!!

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
  •