私はAngular Jを使用しています。私はチェックボックスを持っています、それを選択すると、私は画像を表示しています。チェックボックスをオフにすると、画像の高さが取られないように高さを下げたいと思う。コントロールの高さを動的に変更します
私は以下のコードを使用していますが、チェックボックスがオフの場合、高さは減少していません。 CSSで
<div class="row">
<div class="form-group col-md-8" style="padding-left: 0px !important;">
<label class="control-label col-sm-3">
<input type="checkbox" ng-model="includeImage" ng-checked="true" ng-change="isImageInclude(includeImage)">Include Image
</label>
<img ng-src="{{seasonTypeImage_url}}" style="padding-left: 20px !important;height:40px" id="imgHolder" alt="image will display here." class="imagerowStyle" /> <br />
</div>
:
.imagerowStyle{
width:400px;
height:150px;
}
controller.csにおいて:
$scope.isImageInclude = function(includeImage) {
if ($scope.includeImage) { //If it is checked
$scope.seasonTypeImage_url = $scope.selectedseasonType.ImageUrl;
} else {
$scope.seasonTypeImage_url = _SeasonBaseUrl + "Images//no-imag.png";
jQuery('#imgHolder').css({ height: "40px !important" });
}
}
任意の画像が利用可能である場合
は、幅が400ピクセル超えてはならない、そして高さが150ピクセルを超えてはなりません。使用可能な画像がない場合、高さは40ピクセルを超えてはなりません。 これを修正するには?
答えをご検討ください。コードのみの回答は避けてください – ADyson