Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/431.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 向ui-block-b添加填充_Javascript_Jquery - Fatal编程技术网

Javascript 向ui-block-b添加填充

Javascript 向ui-block-b添加填充,javascript,jquery,Javascript,Jquery,当我在classui-block-b中添加一个padding left时,它的副作用是我的固定navbar也得到了这个填充,这是我不想要的。我只想将填充应用于我的ui-gid-a中的ui-block-b。因此,我尝试添加一个新类ui-block-b-own,但在ui-block-b中没有填充: CSS: 这是代码: function showDetails(index){ var suchresultat = search(); // gets either rezepte or result

当我在class
ui-block-b
中添加一个
padding left
时,它的副作用是我的固定
navbar
也得到了这个填充,这是我不想要的。我只想将填充应用于我的
ui-gid-a
中的
ui-block-b
。因此,我尝试添加一个新类
ui-block-b-own
,但在
ui-block-b
中没有填充:

CSS:

这是代码:

function showDetails(index){

var suchresultat = search(); // gets either rezepte or result

$("#rezept h1").html(suchresultat[index].name);


    var inhalt = "";

var p = suchresultat[index].portionen; 
var m = suchresultat[index].menge;
var z = suchresultat[index].zubereitung;


 var textM = "";
 var textZ = "";


 for( var i = 0; i < m.length; i++ )
 {
       textM += "<br />" + m[i];
 }  

for( var i = 0; i < z.length; i++ )
 {
       textZ += "<br />" + z[i];
 }  

var por;
if (p == 1){  
por = "Portion:";
}
else {
por = "Portionen:";
}

inhalt += '<section class="ui-grid-a">';
inhalt += '<!-- Row1 -->';
inhalt += '<div class="ui-block-a"><strong>Zutaten für<br>'+ p + ' '+ por +'</strong></div>';
inhalt += '<div class="ui-block-b"><strong>Zubereitung:</strong></div>';
inhalt += '<!-- Row2 -->';
inhalt += '<div class="ui-block-a">' + textM + '</div>';
inhalt += '<div class="ui-block-b ui-block-b-own"' + textZ + '</div>';
inhalt += '</section>'; 

$("#rezeptInhalt").html(inhalt); // füllt page id rezept content

$.mobile.changePage($("#rezept"));
函数显示详细信息(索引){
var suchresultat=search();//获取rezepte或result
$(“#rezept h1”).html(suchresultat[index].name);
var inhalt=“”;
var p=suchresultat[index].portionen;
var m=suchresultat[index].menge;
var z=suchresultat[index].zubereitung;
var textM=“”;
var textZ=“”;
对于(变量i=0;i”+m[i];
}  
对于(变量i=0;i”+z[i];
}  
var-por;
如果(p==1){
por=“部分:”;
}
否则{
por=“Portionen:”;
}
inhalt+='';
inhalt+='';
inhalt+='Zutaten für
'+p+'+por+'
; inhalt+='Zubereitung:; inhalt+=''; inhalt+=''+textM+'';
InAlt+='这看起来像是生成了无效的HTML。在您通过
textZ
插入内容之前,所讨论的元素缺少其结束符
。因此将无法正确应用CSS,因为浏览器可能正在猜测节点的正确文本内容应该是什么

inhalt += '<div class="ui-block-b ui-block-b-own">' + textZ + '</div>';
//----------------------------------------------^^^^
inhalt+=''+textZ+'';
//----------------------------------------------^^^^

您不需要用
字符终止HTML行(这是标记,不是编程)。此外,对于您发布的CSS,我们还不完全了解您在做什么。您能修改它,使其成为更完整的()表示形式吗?您好,“;”是因为我从动态创建页面的原始代码复制而来。请参阅changed question.Thx,Andi
inhalt += '<div class="ui-block-b ui-block-b-own">' + textZ + '</div>';
//----------------------------------------------^^^^