jQuery如何显示自定义Ajax消息

时间:2015-11-20 15:38:02

标签: jquery ajax

我正在使用jQuery时间轴的插件。单击更多时,应显示更多信息,但会出现ajax失败消息(有意)。

如何根据点击的时间轴项目获取自定义消息而不是获取失败消息?

功能:

$(window).load(function() {
    // light
    $('.tl1').timeline({
        openTriggerClass : '.read_more',
        startItem : '15/08/2014',
        closeText : 'x',
        ajaxFailMessage: 'This ajax fail is made on purpose. You can add your own message here, just remember to escape single quotes if you\'re using them.'
    });
    $('.tl1').on('ajaxLoaded.timeline', function(e){
        var height = e.element.height()-60-e.element.find('h2').height();
        e.element.find('.timeline_open_content span').css('max-height', height).mCustomScrollbar({
            autoHideScrollbar:true,
            theme:"light-thin"
        }); 
    });

}); 

每个时间轴项目具有相同的格式,并在HTML中显示如下:

<div class="item" data-id="13/07/2012" data-description="Lorem ipsum dolor">
            <a class="image_rollover_bottom con_borderImage" data-description="ZOOM IN" href="images/flat/default/6.jpg" rel="lightbox[timeline]">
            <img src="images/flat/default/6.jpg" alt=""/>
            </a>
            <h2>JULY, 13</h2>
            <span>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exerc...</span>
            <div class="read_more" data-id="13/07/2012">Read more</div>
        </div>
        <div class="item_open" data-id="13/07/2012" data-access="ajax-content-no-image.html">
            <div class="item_open_content">
                <img class="ajaxloader" src="images/timeline/loadingAnimation.gif" alt="" />
            </div>
        </div>

0 个答案:

没有答案