如何在JQuery中编写CSS速记值?

时间:2016-02-01 08:22:35

标签: jquery css

如何获得此CSS声明:

 background: #232222 url("../img/big-team.jpg") no-repeat fixed;

在这里:

$('.class ').css( 'background',  ' //code should be injected here ' );

提前谢谢!

3 个答案:

答案 0 :(得分:1)

只需复制并粘贴CSS声明:

<ul data-role="listview" data-inset="true" id="responsiveid"></ul>

答案 1 :(得分:0)

就像你在css中使用这样:

 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
    static NSString *simpleTableIdentifier = @"TableViewCell";


 TableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];

if (cell == nil) {
    cell = [[TableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];


}

NSLog(@"%@",self.arrData1);

NSDictionary *tempDictionary= [self.arrData1 objectAtIndex:indexPath.row];

//NSLog(@"%@",tempDictionary);

NSString *strFunctionCodeValue =[tempDictionary objectForKey:@"function_code"];
NSString *strStartTimeValue = [tempDictionary objectForKey:@"start_time"];
NSString *strEndTimeValue = [tempDictionary objectForKey:@"end_time"];
NSString *strTotalUnitsValue =[tempDictionary objectForKey:@"total_units"];
NSString *strTotalTimeValue = [tempDictionary objectForKey:@"total_time"];
//NSString *strBreakTimeValue = [tempDictionary objectForKey:@"break_time"];



cell.lblFunctionCodeValue.text = strFunctionCodeValue;
cell.lblStartTimeValue.text = strStartTimeValue;
cell.lblEndTimeValue.text = strEndTimeValue;
cell.lblTotalUnitsValue.text =strTotalUnitsValue;
cell.lblTotalTimeValue.text = strTotalTimeValue;
//cell.lblBreakTimeValue.text = strBreakTimeValue;



return cell;

答案 2 :(得分:0)

您也可以尝试使用css速记属性

   $(".class").css({
          "background-color":"#232222",
          "background-image": "url('../img/big-team.jpg')",
          "background-repeat":"no-repeat",
          "background-position":"fixed"
      });