2016-05-12 2 views
0

表示/非表示メニューをクリックしてパラテキストを表示すると、パラテキストが約1行で表示されるのはなぜですか?私の推測では、パディングやマージンなどです。表示/非表示のメニューをクリックしたときに、テキストが改行する理由

$(document).on('click touchstart', '.button', function() { 
 
    $('.target-button[data-trigger="' + $(this).attr('id') + '"]').slideToggle(100); 
 
});
#main_text { 
 
    float: none; 
 
} 
 
.scripture { 
 
    width: 100%; 
 
    padding-top: 30px; 
 
} 
 
.scripture ul { 
 
    list-style-type: none; 
 
    margin: 0; 
 
    background-color: black; 
 
    text-align: center; 
 
} 
 
.scripture li { 
 
    display: inline; 
 
    padding-right: 2em; 
 
    font-weight: bold; 
 
} 
 
.scripture a { 
 
    color: white; 
 
} 
 
.scripture h3 { 
 
    padding: 0; 
 
    margin-top: 0; 
 
} 
 
.scripture h2 { 
 
    margin: 0; 
 
    padding: 0; 
 
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> 
 
<div class="scripture"> 
 
    <UL> 
 
    <li><a id="one" class="button">Expand/Contract</a> 
 
    </li> 
 
    </UL> 
 

 
    <div class="one"> 
 
    <h2>Lively Bones</h2> 
 
    <h3>John 11:1-44</h3> 
 

 
    <div class="target-button" data-trigger="one" style="display:none;"> 
 
     <div id="one1"> 
 

 
     <P>“Ezekiel connected them dry bones, Ezekiel connected them dry bones, Ezekiel connected them dry bones, Now hear the word of the Lord.”</P> 
 

 
     </div> 
 
    </div> 
 
    </div> 
 
</div>

答えて

1

それは.slideToggle(100)コードによる起こっています。とにかくスライドがあまり進んでいないように見えるので、単に.toggle()を使用してみてください。

1

あなたは.scriptureにmargin-bottom:0を指定できます。 http://screencast.com/t/EOuMgTpM

これは対応しています。 素晴らしい一日を!あなたのスタイルシートにこれを追加すること

1

試してみてください。

.target-button p { 
    margin: 0; 
} 

私は、これはjQueryのは、あなたが上slideToggleを呼び出している隠された要素の高さを決定する方法に関連していると信じています。

関連する問題