Search code examples
jqueryimagetwitter-bootstraptimestampbxslider

Not able to load image in a slider


Hi i am using a pre built bootstrap theme, It has a slider of images, it seems to work fine with its default slider images, but when i am changing the url of images, a timestamp is being added behind it which is hindering the display of images, can anyone please tell how to remove timestamp from the image url.

The code is

<ul class="bxslider1 clients-list">
    <li>
        <a href="#">
            <img src="img/clients/one.png" alt="" />
        </a>
    </li>

    <li>
        <a href="#">
            <img src="img/clients/two.png" alt="" />
        </a>
    </li>
</ul>

The timestamp that is being added is

img/clients/one.png?timestamp=1476957097630

Is there a way i can remove this timestamp

Would appreciate any help and suggestions


Solution

  • $( document ).ready(function(e) { 
        var images = $('img').attr('src');
       
        var imgSrc = images;
        imgSrc = imgSrc.substring(0 , imgSrc.indexOf('?')+0);
      $('#url').html(imgSrc);
     // alert(imgSrc);
    });
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <ul class="bxslider1 clients-list">
        <li>
            <a href="#">
                <img src="img/clients/one.png?timestamp=1476957097630" alt="" />
            </a>
        </li>
    
        <li>
            <a href="#">
                <img src="img/clients/two.png?timestamp=1476957097630" alt="" />
            </a>
        </li>
    </ul>
    
    <div id="url"></div>