【发布时间】:2018-05-06 03:56:26
【问题描述】:
import { Component, OnInit, ElementRef, Input, ViewChild, Output, EventEmitter } from '@angular/core';
declare var JQuery: any;
export class PresentationComponent implements OnInit {
constructor( public _eleRef : ElementRef,public CommonComponentService:CommonComponentService ) {
}
ngOnInit() {
jQuery(this._eleRef.nativeElement).find('#Fullscreen').on('click',function(){
jQuery('#exampleImage').width(jQuery(window).width());
jQuery('#exampleImage').height(jQuery(window).height());
});
}
}
.slide-control {
z-index: 5;
background-color: #323232;
overflow: hidden;
border: 0;
padding: 0;
width: 100%;
color: #fff;
font-size: 13px;
max-height: 56px;
min-height: 50px;
///text-align: center;
}
.control {
font-size: 20px;
padding: 10px;
cursor: pointer;
}
.slide-control #fullscreen {
float: right !important;
}
.imageArea {
background-color: #e5e5e5;
border: 1px inset #323232;
}
.resize {
width: 100%;
}
<div class="row imageArea">
<div class="mx-auto">
<img [src]="newUrl" id="exampleImage" class="img-fluid" alt="Responsive image">
</div>
<div class="slide-control form-inline">
<div *ngIf="!buttonShowFlag" class="mx-auto">
<span class="control" (click)="back()"><i class="fa fa-arrow-left" aria-hidden="true"></i></span>
<span>{{count+1}} / {{finalCount}}</span>
<span class="control" (click)="next()"><i class="fa fa-arrow-right" aria-hidden="true"></i></span>
</div>
<div class="mx-auto" *ngIf="buttonShowFlag">
<button (click)="cfuModal.show()" class="btn">{{'Stepper.Next' | translate}}</button>
</div>
<div class="fullscreen float-right">
<span class="control" id="download" *ngIf="download"><a href={{downloadLink}} download><i class="fa fa-download" aria-hidden="true"></i></a></span>
<span class="control" id="Fullscreen"><i class="fa fa-arrows-alt text-right" aria-hidden="true"></i></span>
</div>
</div>
</div>
您好,我正在使用 Angular 2。我正在使用自定义控件设计自己的图像查看器。有一个全屏按钮可用。我想让我的图像在单击该按钮时全屏显示,当我再次单击该按钮时,它应该转到以前的状态,这意味着我想让它切换。我在 Angular 2 中嵌入 jquery。当我点击它时,它会使我的图像全屏显示,但我怎样才能让它切换。
【问题讨论】:
标签: javascript jquery css angular angular2-template