2010-04-07 16 views
232

Mam textarea html o stałej szerokości, ale o zmiennej wysokości. Chciałbym ustawić przepełnienie: przewiń i pokaż pionowy pasek przewijania, ale nie poziomo. Nie mogę korzystać z przepełnienia: auto ze względu na inne rzeczy specyficzne dla mojej sytuacji.Ukryj pionowy pasek przewijania w poziomie ale nie pionowy

Wiem, że nie ma możliwości użycia CSS 2 do wyświetlania tylko pionowych, ale nie poziomych pasków przewijania. Czy jest coś, co mogę zrobić z javascriptem, aby ukryć poziomy pasek przewijania?

+2

Nie, korzystając CSS2 i 'overflow: scroll;' nie ma sposobu, aby pokazać jeden bar, a nie inny. Jest to nieodłączne z 'overflow: scroll'; javascript może wykonywać tylko to, na co pozwala CSS. Jednak domyślam się, że możesz * użyć * przepełnienia: auto, po prostu nie wiesz jak. Czy opracowałbyś "inne rzeczy specyficzne dla twojej sytuacji"? – tloflin

Odpowiedz

490

Można użyć css tak:

overflow-y: scroll; 
overflow-x: hidden; 
+2

Widzę to jako CSS3 i nie działa w Firefoksie, kiedy go testuję. Widzę również, że jest dostępna jako własność tylko dla IE z powrotem w ciągu dnia. –

+0

@wiliamjones - Działa to w firefox ... masz przykładową stronę? Może być jakiś inny powód układu, który nie działa. –

+0

@william - Oto pełny przykład tego działa, test w firefox :) http://jsfiddle.net/qpZ8k/ –

24

użyć CSS. To jest łatwiejsze i szybsze niż javascript.

overflow-x: hidden; 
overflow-y: scroll; 
7

Korzystanie wrap=virtual w HTML pól formularza pozbywa poziomego paska przewijania w dolnej części okna:

<textarea name= "enquiry" rows="4" cols="30" wrap="virtual"></textarea> 

Zobacz przykład tutaj: http://jsbin.com/opube3/2(Testowane na FF i IE)

2
<div style="width:100px;height:100px;overflow-x:hidden;overflow-y:auto;background-color:#000000"> 
1
.combobox_selector ul { 
    padding: 0; 
    margin: 0; 
    list-style: none; 
    border:1px solid #CCC; 
    height: 200px; 
    overflow: auto; 
    overflow-x: hidden; 
} 

ustawia rozmiar zwoje 200px, overflow-x ukrywa poziomy pasek przewijania.

14

Wyłącz całkowicie poziomy pasek przewijania, dodając ten kod.

body{ 
    overflow-x: hidden; 
    overflow-y: scroll; 
} 
0

Dla mnie:

.ui-jqgrid .ui-jqgrid-bdiv { 
    position: relative; 
    margin: 0; 
    padding: 0; 
    overflow-y: auto; <------ 
    overflow-x: hidden; <----- 
    text-align: left; 
} 

Oczywiście usunięcia strzałkami

0
selector{ 
overflow-y: scroll; 
overflow-x: hidden; 
} 

przykład Praca z urywek i jsfiddle linku https://jsfiddle.net/sx8u82xp/3/

enter image description here

.container{ 
 
    height:100vh; 
 
    overflow-y:scroll; 
 
    overflow-x: hidden; 
 
    background:yellow; 
 
}
<div class="container"> 
 

 
<p> 
 
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. 
 

 
Why do we use it? 
 
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). 
 
</p> 
 

 
<p> 
 
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. 
 

 
Why do we use it? 
 
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). 
 
</p> 
 

 
<p> 
 
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. 
 

 
Why do we use it? 
 
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). 
 
</p> 
 

 
<p> 
 
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. 
 

 
Why do we use it? 
 
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). 
 
</p> 
 

 
</div>

Powiązane problemy