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 8446685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:59:23+00:00 2026-06-10T09:59:23+00:00

I have a gallery in Jquery Elastislide. var imageIndex = 0; if (window.location.hash) {

  • 0

I have a gallery in Jquery Elastislide.

 var imageIndex = 0; 
if (window.location.hash) {
    var imageIndexStr = window.location.hash.replace('#',''); // remove #
    imageIndex = parseInt(imageIndexStr, 0); // convert to int
}

Thanks to the code above, The gallery got pictures with corresponding Hash.
http://www.example.com/gallery.html#1_TITLE_OF_THE_PICTURE

When I put the code to navigate with arrows of the gallery, I get in the following URL :
http://www.example.com/gallery.html#1

_navigate       = function( dir ) {



                // navigate through the large images

                if( anim ) return false;
                anim    = true;

                if( dir === 'right' ) {
                    if( current + 1 >= itemsCount )
                        current = 0;
                    else
                        ++current;
                }
                else if( dir === 'left' ) {
                    if( current - 1 < 0 )
                        current = itemsCount - 1;
                    else
                        --current;
                }

                _showImage( $items.eq( window.location.hash = current) );

So, I want some help in order to get in the URL the full Hash.

http://www.example.com/gallery.html#1_TITLE_OF_THE_PICTURE

HTML Code :

<head>
<style>
                .es-carousel ul{
                    display:block;
                }
            </style>

            <script id="img-wrapper-tmpl" type="text/x-jquery-tmpl">    
            <div class="rg-image-wrapper">
                {{if itemsCount > 1}}
                    <div class="rg-image-nav">
                        <a href="#"  class="rg-image-nav-prev">Previous Image</a>
                        <a href="#"  class="rg-image-nav-next">Next Image</a>
                    </div>
                {{/if}}
                <div class="rg-image"></div>
                <div class="rg-loading"></div>
                <div class="rg-caption-wrapper">
                    <div class="rg-caption" style="display:none;">
                        <p></p>
                    </div>
                </div>
            </div>
        </script>
</head>

<body>

<div class="container_gallery">


<div id="rg-gallery" class="rg-gallery">
                    <div class="rg-thumbs">
                        <!-- Elastislide Carousel Thumbnail Viewer -->

                        <div class="es-carousel-wrapper">
                            <div class="es-nav">
                                <span class="es-nav-prev">Previous</span>
                                <span class="es-nav-next">Next</span>
                            </div>
                            <div class="es-carousel">
                                <ul>
                                    <li> <a href="#0_Title_1"><img src="picture_thumb.jpg" data-large="picture.jpg" alt="Title_1" data-description="Title_1"  /></a></li>

href="#0_Title_2"><img src="picture2_thumb.jpg" data-large="picture2.jpg" alt="Title_2" data-description="Title_2"  /></a></li>

href="#0_Title_3"><img src="picture3_thumb.jpg" data-large="picture3.jpg" alt="Title_3" data-description="Title_3"  /></a></li>



</ul>
                            </div>
                        </div>
                        <!-- End Elastislide Carousel Thumbnail Viewer -->
                    </div><!-- rg-thumbs -->
                </div><!-- rg-gallery -->



</div>

Event Navigation :

$('#img-wrapper-tmpl').tmpl( {itemsCount : itemsCount} ).prependTo( $rgGallery );

            if( itemsCount > 1) {
                // addNavigation
                var $navPrev        = $rgGallery.find('a.rg-image-nav-prev'),
                    $navNext        = $rgGallery.find('a.rg-image-nav-next'),
                    $imgWrapper     = $rgGallery.find('div.rg-image');

                $navPrev.on('click.rgGallery', function( event ) {
                    _navigate( 'left' );
                    return false;
                }); 

                $navNext.on('click.rgGallery', function( event ) {
                    _navigate( 'right' );
                    return false;
                });

                // add touchwipe events on the large image wrapper
                $imgWrapper.touchwipe({
                    wipeLeft            : function() {
                        _navigate( 'right' );
                    },
                    wipeRight           : function() {
                        _navigate( 'left' );
                    },
                    preventDefaultEvents: false
                });

                $(document).on('keyup.rgGallery', function( event ) {
                    if (event.keyCode == 39)
                        _navigate( 'right' );
                    else if (event.keyCode == 37)
                        _navigate( 'left' );    
                });

            }

        },

Thanks for your answers.

  • 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-06-10T09:59:24+00:00Added an answer on June 10, 2026 at 9:59 am

    This line of code is setting the hash value to just be a number which would cause it to become something like: www.example.com/gallery.html#1.

    _showImage( $items.eq( window.location.hash = current) );
    

    It looks to me like your navigate function is not putting the title onto the new hash value when you change pictures. I think you want something like this:

    window.location.hash = current + "_" + newPictureTitle;
    _showImage( $items.eq(current) );
    

    Where you obviously need to fill in the value of newPictureTitle


    Based on the HTML and other javascript you’ve shown, your _navigate() function could work like this:

    _navigate  = function( dir ) {
        // navigate through the large images
        if( anim ) return false;
        anim    = true;
    
        if( dir === 'right' ) {
            if( ++current >= itemsCount )
                current = 0;
        } else if( dir === 'left' ) {
            if( --current < 0 )
                current = itemsCount - 1;
        }
    
        // show the right image
        _showImage( $items.eq(current) );
    
        // now get the right image title so it can go in the hash value
        // we assume here that current is a zero based index
        var links = $("#rg-gallery .es-carousel li a");
        // use getAttribute here to get the raw href that's in the 
        // HTML source file (not a fully qualified URL)
        window.location.hash = links.get(current).getAttribute("href");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a gallery in jQuery Elastislide. Pictures get a hash. When I click
I have a gallery in jQuery Elastislide. Each pictures of the gallery has a
I have made a image gallery with jQuery found here: http://sarfraznawaz2005.kodingen.com/demos/jquery/image_gallery/ I just wanted
I have been creating an image gallery with jQuery, all is done. The images
Jquery, AJAX and URL changes... I have a gallery, and when the image change
I have a jquery gallery (galleriffic), which opened nyroModal and a good set size.
currently I have the a basic jQuery gallery: <ul> <li>IMAGE</li> <li>IMAGE</li> </ul> // with
I have the following gallery set up in jQuery: - <script type=text/javascript> $(function ()
I'm having an odd issue in FF10 using jQuery 1.7.1. I have a gallery
I am trying to remove <br /> tag from wordpress native gallery through jquery

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.