我有一些像
这样的代码var innerPage = {
/* declare vars, cache selectors */
leftWidth : $("#episodes-nav").width(),
right : $("#episodes-right"),
theWindow : $(window),
heroImageHolder : $("#hero-image-holder"),
heroImage : $("#hero-image"),
whiteOverlay : $("#white-overlay"),
tilesContainer : $("#tiles-container"),
heroPercentToShow : 0.6,
// heroHolderWidth : this.heroImageHolder.width(),
// heroHolderHeight : this.heroImageHolder.height(),
heroImgRealW : null,
heroImgRealH : null,
/* init */
init : function(){
var that = this;
this.heroImage.on('load', function(){
// image loaded .. do something
that.heroImgRealW = this.naturalWidth;
that.heroImgRealH = this.naturalHeight;
that.fitHeroImage();
that.buildInnerBlocks();
});
},
fitHeroImage : function(){
var desiredWidthToFit = this.heroPercentToShow * this.heroNaturalW;
var scaleRatio = this.heroViewportWidth / desiredWidthToFit;
//trace(scaleRatio);
this.heroImage.width( this.heroImage.width() * scaleRatio );
var offsetSides = (600 -this.heroImage.width() ) / 2;
var offsetTop = (containerHeight -this.heroImage.height() ) / 2;
//trace("top"+offsetTop);
this.heroImage.css("left", offsetSides);
this.heroImage.css("top", offsetTop);
this.heroImage.height( this.heroImage.height() * scaleRatio );
},
/* destroy */
destroy : function(){
},
/* sizeChildren */
sizeChildren : function(){
this.right.width( this.theWindow.width() - this.leftWidth );
this.whiteOverlay.width( this.right.width() - this.heroImageHolder.width() +2000 );
this.tilesContainer.width( this.whiteOverlay.width() );
this.fitHeroImage();
//$("#tiles-container").empty();
}
}
当我在函数或其中设置断点时,它们不会被触发(在chrome中测试)。我该如何解决这个问题?
答案 0 :(得分:0)
当您调用这些函数时,函数中的断点将会触发,但是您应该能够在创建innerPage之后设置断点来检查它。