jQM - Flexslider example

HTML

<!DOCTYPE html>
<html>
<head>
    <title>jQM Complex Demo</title>
    <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=no; target-densityDpi=device-dpi"/>
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
    <link rel="stylesheet" href="http://flexslider.woothemes.com/css/flexslider.css" />    
    <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>    
    <script src="http://flexslider.woothemes.com/js/jquery.flexslider.js"></script>            
</head>
<body>
    <div data-role="page" id="index">
        <div data-theme="a" data-role="header">
            <h3>
                First Page
            </h3>
            <a href="#second" class="ui-btn-right">Next</a>
        </div>

        <div data-role="content">
            <div class="flexslider">
              <ul class="slides">
                <li>
                  <img src="http://flexslider.woothemes.com/images/kitchen_adventurer_cheesecake_brownie.jpg" />
                </li>
                <li>
                  <img style='width:505;height:318px' src="http://f1.pepst.com/c/FE8AA7/658312/ssc3/home/079/manirai/countdown_6ilwi6xx_8983621441442743294.gif_480_480_0_64000_0_1_0.gif" />
                </li>
                <li>
                  <img src="http://flexslider.woothemes.com/images/kitchen_adventurer_donut.jpg" />
                </li>
                <li>
                  <img src="http://flexslider.woothemes.com/images/kitchen_adventurer_caramel.jpg" />
                </li>
              </ul>
            </div>
        </div>

        <div data-theme="a" data-role="footer" data-position="fixed">

        </div>
    </div>   
</body>
</html>

JavaScript

$(document).on('pageshow', '#index', function(){       
    $('.flexslider').flexslider({
        animation: "slide",
        before: function(slider){
          var src = $(slider).find('.flex-active-slide').next().find('img').attr('src');
        
        //change the next slide img src to empty and back to the original src
        $(slider).find('.flex-active-slide').next().find('img').attr('src','').attr('src',src);
        }
      });
});