2017-02-28 74 views
0

我已经为我的应用程序应用了背景图像选项,但它的工作良好。但我想修复背景图像使用适合选项,如填充,适合,strech等......如何为我的应用程序应用该选项取决于用户选择的选项。背景图片适合选项?

code:

+3

请添加您的代码。 – dorado

+0

@(Html.Kendo()。DropDownList的() 请将.Name( “infobgimagefitType”) .Events(EV => ev.Open( “positionDropDown”)) .BindTo(inSisEnums.Enums.EnumToSelectList(typeof运算(inSisEnums。 InfobgimageFitType))) .SelectedIndex(((int)的ViewBag.Settings.Imagefittype)) .HtmlAttributes(新{式= “宽度:90像素;字体大小:小;浮动:右”}) ) –

+0

我想以像Windows桌面图像一样工作的功能 –

回答

0

为fill,Stretch和fit创建CSS类。 使用addClass将它们添加到背景div或使用toggleClass通过JS进行切换。

.fill { 
    background: url('image.jpg'); 
    background-repeat: repeat; 
} 

.stretch{ 
    background: url('image.jpg'); 
    background-size: cover; 
}