Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Photo Revealer: How to make image the open.click or close.click

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #31626
    modrn
    Member

    In the demo for ( https://css-tricks.com/examples/RevealingPhotoSlider2/ ) how can I make the Photo itself the open.click or close.click ??

    The original:


    var $wrap = $('
    ').append($img).prependTo($this);

    var $open = $('More Info >').appendTo($this);

    var $close = $('Close').appendTo($info);

    Ive tried a multitude of different things to make the photo_slider_img what was being used for open.click and close.click but i cant figure it out?

    Can anyone help me.. im sure its simple but im not extremely proficient in js. Mucho Gracias.

    #60369
    modrn
    Member

    Hate to bump after a couple hours but im limited on time for figuring this out or im going to have to go another direction with what im wanting to do.

    #60272
    Sirlon
    Member

    Well i would say


    $img.click(function(){

    if($img.css("margin-top") == '-150px'){
    $this.animate({

    width: opts.imgw,

    height: (opts.imgh+95),

    borderWidth: "10"



    }, 600 );



    $open.fadeOut();



    $wrap.animate({

    width: opts.imgw,

    height: opts.imgh

    }, 600 );



    $(".info_area",$this).fadeIn();



    $img.animate({

    marginTop: "0px",

    marginLeft: "0px"

    }, 600 );

    } else {
    $this.animate({

    width: opts.orgw,

    height: opts.orgh,

    borderWidth: "1"

    }, 600 );



    $open.fadeIn();



    $wrap.animate({

    width: opts.wrapw,

    height: opts.wraph

    }, 600 );



    $img.animate({

    marginTop: "-150px",

    marginLeft: "-150px"

    }, 600 );



    $(".info_area",$this).fadeOut();


    }

    return false;

    });

    not testet.

    #60111
    modrn
    Member

    alright ill try it out and get back to you.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.