问题出在变量定义语法中,您还需要将jQuery脚本包装到no conflict 包装器,试试这个
jQuery(window).load(function($) {
// your function
});
或
(function($) {
// your function
})(jQuery);
完成工作脚本
(function($) {
$(window).load(function() {
var lightBox = $(\'#lightbox\');
var lightBoxContent = $(\'#lb-content\');
var positionLightbox = function() {
var veiwWidth = $(window).width();
var lbContentMargin = (veiwWidth / 2) - 148;
var lbContent = $(\'#lb-content\');
lbContent.css({
\'left\' : lbContentMargin,
\'top\' : $(window).scrollTop() + 50 + \'px\'
});
};
$(\'.modal-trigger\').click(function() {
lightBox.fadeIn(function() {
lightBoxContent.show();
});
positionLightbox();
});
$(\'#lb-close\').click(function() {
lightBox.hide();
lightBoxContent.hide();
});
});
})(jQuery);