Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready( function() {
- $("#categories>div>img").click( function() {
- $('#frame-big-image').show();
- $('#big-image').show();
- var imgID = $(this).attr('id');
- var parentID = $(this).parent().attr('id');
- var source = $(this).attr('src');
- var alter = $(this).attr('alt');
- var counter = $('#'+imgID).index();
- var max = $("#"+parentID).children().length - 1;
- $('#big-image').prepend("<img src="+source+" alt="+alter+">");
- $('#big-image').mouseenter( function() {
- $('#close').fadeIn('fast');
- $('#nav-left').fadeIn('fast');
- $('#nav-right').fadeIn('fast');
- $('#close').click( function() {
- $('#close').fadeOut('fast');
- $('#nav-left').fadeOut('fast');
- $('#nav-right').fadeOut('fast');
- $('#frame-big-image').fadeOut('fast');
- $('#big-image').fadeOut('fast');
- $('#big-image>img').remove();
- });
- $('#nav-left').click( function() {
- $('#big-image>img').remove();
- if ( counter == 0 ) counter = max;
- else counter--;
- var sourceL = $("#"+parentID+">img").eq(counter).attr('src');
- var alterL = $("#"+parentID+">img").eq(counter).attr('alt');
- $('#big-image').prepend("<img src="+sourceL+" alt="+alterL+">");
- });
- $('#nav-right').click( function() {
- $('#big-image>img').remove();
- if ( counter == max ) counter = 0;
- else counter++;
- var sourceR = $("#"+parentID+">img").eq(counter).attr('src');
- var alterR = $("#"+parentID+">img").eq(counter).attr('alt');
- $('#big-image').prepend("<img src="+sourceR+" alt="+alterR+">");
- });
- })
- .mouseleave(function() {
- $('#close').fadeOut('fast');
- $('#nav-left').fadeOut('fast');
- $('#nav-right').fadeOut('fast');
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment