Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5846803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:37:43+00:00 2026-05-22T12:37:43+00:00

I am trying to create an image gallery, I am using numbers instead of

  • 0

I am trying to create an image gallery, I am using numbers instead of left/right arrows. At the moment, I am trying to get it working with only 2 image (i.g 2 numbers)

this is the html . the id page, is the highlighted number

 <div class="grid_1 pagelink" id="page"><p><a href="">1</a></p></div> 
<div class="grid_1 pagelink"><p><a href="">2</a></p></div> 

the first time the page loads, the code below works. so when I click on link 2 the the code bellow runs fine. But then I want the same code to be triggered when I click back on the first link; but when I do that, the page refreshes by ignoring the code bellow:

 $('.pagelink').live('click', function(e){
    e.preventDefault();
        var frame = $(this).text() - 1;
        var frames =     240 * frame;
    //  $('#gal').animate({marginLeft:'500px'},'slow'); 
        $('#gal').animate({marginLeft:  "+="+frames+'px'},'slow');
    $(this).attr('id', 'page').removeClass('pagelink');
    $('#page').addClass('pagelink').removeAttr('id','page');
       // $('#book').animate({    left: '50'  });
    })

I thought that the .live() would do that for me but it is not working.

I hope you could help

thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T12:37:43+00:00Added an answer on May 22, 2026 at 12:37 pm

    Previous, this is because you are removing the class of link “pagelink” which were used to map the clicked event.

    Also, use another class instead of id(#page) to identify the #page link, id might be problem if its already assign to other link. like

    $(this).removeClass('pagelink').addClass('page');
    $('.page').addClass('pagelink').removeClass('page');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a sortable image matrix, 5x5 using scriptaculous javascript library
I'm trying to create a simple image gallery, showing 16 images per page. I'm
I'm trying to create an image gallery from an rss feed with the galleryview
So I am trying to create an image gallery. My AIR application accepts files
I am trying to create an image gallery, such as when you click an
I'm trying to create a WPF application where I can drag an image around.
Trying to create a QtRuby application, I get the following error: /usr/lib64/ruby/site_ruby/1.8/Qt/qtruby4.rb:2144: [BUG] Segmentation
Trying to create several layers of folders at once C:\pie\applepie\recipies\ without using several different
I am trying to create a css based image rollover navigation bar. For some
I'm trying to create a variable background, where the image changes based on the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.