2012-02-17 12 views
12

मैं एक कस्टम स्क्रॉल का उपयोग कर रहा हूं जो क्रोम में ठीक काम करता है ... लेकिन यह फ़ायरफ़ॉक्स या आईई 9 में काम नहीं करता है।फ़ायरफ़ॉक्स और आईई में कस्टम स्क्रॉल कैसे प्राप्त करें?

::-webkit-scrollbar { 
    width: 7px; 
    height: 1px; 
} 

::-webkit-scrollbar-thumb  
{ 
    height: 1em; 
    background: #ccc -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(240, 240, 240)), to(rgb(250, 250, 250))); 
    -webkit-border-radius: 5px; 
} 

::-webkit-scrollbar-button:end:increment { 
    background:url(../images/down.png) center no-repeat; 
} 

::-webkit-scrollbar-button:start:decrement 
{ 
    background:url(../images/up.png) center no-repeat; 
} 
+1

@pacofvf: यही वही है जो वह पूछ रहा है। – SLaks

+0

@Slaks यदि आप सही हैं, तो आपको यह पूछने के लिए प्रश्न संपादित करना चाहिए। मुझे नहीं लगता कि ओपी उसे जानता था।मैं बस उसे सही दिशा में इंगित करना चाहता था। –

+0

क्या आप अपनी स्क्रॉलबार को दिखने के लिए स्क्रीनशॉट पोस्ट कर सकते हैं? मैं उपरोक्त कोड में सूचीबद्ध छवियों को नहीं देख सकता हूं। –

उत्तर

25

एक मालिकाना वेबकिट संपत्ति है:

यह सीएसएस है। एफएफ या आईई के लिए कोई समकक्ष नहीं है।

हालांकि, आप जो भी कर रहे हैं वह jQuery के साथ कर सकते हैं।

http://manos.malihu.gr/tuts/jquery_custom_scrollbar.html

संपादित करें: Uhhh .. वहाँ सचमुच कोई फ़ायरफ़ॉक्स बराबर है और व्यक्ति सवाल पूछने का शाब्दिक या तो एक जावास्क्रिप्ट समाधान, या बिल्कुल भी कोई समाधान का उपयोग करना चाहिए है। डाउनवॉट्स इसे नहीं बदलेगा।

+0

ऐसा है कि यह प्लगइन केवल निश्चित ऊंचाई कंटेनर के लिए लागू है? – Blake

4

फ़ायरफ़ॉक्स वर्तमान में स्क्रॉलबार को बदलने के लिए कोई तरीका मौजूद नहीं करता है (एक कुछ हद तक संबंधित समस्या के लिए bug 77790 देखें), इंटरनेट एक्सप्लोरर संस्करण 5.5 (केवल रंग का समर्थन करता है) के बाद से सीमित कार्यक्षमता पड़ा है। अधिक जानकारी के लिए, MSDN's User Interface page पर इसके बारे में और पढ़ें।

नोट: वाक्य रचना हमेशा IE में स्क्रॉलबार रंग बदलने के लिए एक ही नहीं किया गया है, तो आप पुराने संस्करणों का समर्थन करने के लिए देख रहे हैं (मेरा मानना ​​है कि 7 और से कम), तो आप पुराने सिंटैक्स का उपयोग करना होगा भी।

+3

मैं हमेशा आश्चर्यचकित हूं कि एक आगे सोचने वाला ब्राउज़र IE वास्तव में क्या था। निश्चित रूप से, वे इसके बारे में पूरी तरह से गैर-मानक थे, लेकिन उनके पास घूर्णन, ग्रेडियेंट, ड्रॉप छाया, और कई अन्य साफ-सुथरे विशेषताओं को किसी और के सामने अच्छी तरह से था। –

+2

@ChrisSobolewski - क्योंकि वे स्वयं के लिए चीजें कर रहे थे, वेब के लिए नहीं। उस समय अन्य ब्राउज़र मौजूद नहीं थे या केवल मानक का पालन किया था। – Rob

0

मैंने custom scrollbar library named SimpleScrollbar विकसित किया है।

यह किसी भी अन्य पुस्तकालय/ढांचे पर निर्भर नहीं है, और यह gzip और minification के बाद 1KB से कम है।

यह देशी स्क्रॉल का उपयोग करता है, इसलिए कोई हैक नहीं है, और प्रदर्शन शानदार है।


आप केवल अपने पेज में पुस्तकालय शामिल हैं, और किसी भी div कि आप स्क्रॉल करने योग्य बनाना चाहते में ss-container विशेषता का उपयोग करने की जरूरत है। लाइव उदाहरण:

<link href="http://buzinas.github.io/simple-scrollbar/simple-scrollbar.css" rel="stylesheet"/> 
 
<div style="height: 180px; width: 200px; display: inline-block;" ss-container> 
 
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> 
 
</div> 
 
<section style="height: 180px; width: 300px; display: inline-block;" ss-container> 
 
    <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?</p> 
 
     <p>But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?</p> 
 
</section> 
 
<!--[if IE 9]><script src="https://cdn.jsdelivr.net/classlist/2014.01.31/classList.min.js"></script><![endif]--> 
 
<script src="http://buzinas.github.io/simple-scrollbar/simple-scrollbar.min.js"></script>


यह सभी आधुनिक ब्राउज़रों (फ़ायरफ़ॉक्स, क्रोम, ओपेरा, सफारी, एज) पर काम करता है, और IE10 और IE11 पर। आप इसे क्लासलिस्ट पॉलीफिल समेत आईई 9 में भी इस्तेमाल कर सकते हैं।

सभी एंड्रॉइड, आईओएस और विंडोज फोन ब्राउज़र या तो समर्थित हैं।

संबंधित मुद्दे