ajax引入链接,当通过ajax引入链接时,jquery colorbox插件会中断

我正在使用jquery和colorbox构建一个基本的ajax日历。这是正在进行的网站的链接:

当用户点击日历控件中的链接时,脚本会通过ajax请求该页面并更新日历。

我遇到的问题是日历表中的弹出链接。首次加载页面时(http://208.79.237.222/calendar/),链接按预期完美运行,以彩色模式打开。

但是,使用ajax日历来回点击几个月后,然后单击日历表中的一个链接,颜色框模式除了显示黑色大屏幕外什么也没有显示。

非常奇怪,我将.colorbox()事件作为ajax回调的一部分附加,所以我不知道这是怎么回事

任何帮助将不胜感激

function update_cal(evt)

{

// don't follow the link

evt.preventDefault();

// get the calendar data from the link's href of select option value

// and turn it into an array

var $tgt = $(evt.target);

var url_to_get;

if($tgt.is('a'))

{

url_to_get = $tgt.attr('rel');

}

else if($tgt.is('select'))

{

url_to_get = $tgt.val();

}

// empty the calendar and show a loading graphic

$('#cal-content').css({

background:'url(/media/interface_img/ajax-load.gif) no-repeat center center',

height:'500px'

}).html('');

// get the content via ajax and add them to the page

$.get(url_to_get, {},

function(returned_data)

{

$('#large-calendar').html(returned_data);

// must call this to add events to the newly added ajax elements

add_cal_events();

// update select menu

// var slug- + get_array[5]

// check if cat filter exists

// if it does, find out what it says

// select option for that category

// return false so don't trigger change event

}

);

}

function add_cal_events()

{

$('#cal-nav-previous').unbind().bind('click.prev', update_cal);

$('#cal-nav-next').unbind().bind('click.next', update_cal);

$('#cal-nav-today').unbind().bind('click.today', update_cal);

$('#cal-view-toggle').unbind().bind('click.view', update_cal);

$('#cal-print').unbind().bind('click.print', function(evt){

window.print();

evt.preventDefault();

});

$('#cal-category-select').unbind().bind('change.filter', update_cal);

$('#cal-category-clear').unbind().bind('click.clear', update_cal);

$('a.trigger-modal').unbind().colorbox(

{

transition : 'none',

title : false,

width : 500,

height : 380,

iframe : true,

photo : false,

//inline : true,

opacity : 0,

scrolling : true

}

);

}

//

// and finally the document.ready

//

$(document).ready(function() {

// Load event handlers for calendar controls

add_cal_events();

}); // end $(documemnt).ready

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值