Comments (7)
Hi, @NigelOToole !
JCF library tries to avoid inline styles on the fake select element so you don't have to worry about priority of your CSS rules vs inline html styles.
Responsive behavior can be achieved with CSS. For example you have:
<select class="foo">...</select>
Now you can control styles of custom select like this:
select.foo,
select.foo + .jcf-select {
width: 50%;
}
Or you can use the class
of your select element which is automatically copied and prefixed with "jcf-select-"
by JCF library:
.jcf-select-foo {
width: 50%;
}
Will this work for your case?
from jcf.
Hi
Thanks for the reply and I can understand trying to avoid inline styles but
this is the only way I could always get them to line up.
I have already tried using styles as suggested but this didnt work. The
strange thing is that my developer tools in firefox are saying all the
element, the native select, the jcf-select and the jcf-select-drop have the
same pixel width but the edges dont line up untill I added the inline
styles.
Regards,
Nigel
On 23 June 2015 at 17:11, Sergey [email protected] wrote:
Hi, @NigelOToole https://github.com/NigelOToole !
JCF library tries to avoid inline styles on the fake select element so you
don't have to worry about priority of your CSS rules vs inline html styles.Responsive behavior can be achieved with CSS. For example you have:
...
Now you can control styles of custom select like this:
select.foo,select.foo + .jcf-select {
width: 50%;
}Or you can use the class of your select element which is automatically
copied and prefixed with "jcf-select-" by JCF library:.jcf-select-foo {
width: 50%;
}Will this work for your case?
—
Reply to this email directly or view it on GitHub
#6 (comment).
from jcf.
Ok. Are you testing on the retina display?
Maybe you could provide a jsfiddle, so I can reproduce the issue?
BTW, you can try fakeDropInBody: false
option which will put the drop inside the fake select element and it will have the same width as the container without any inline styles.
from jcf.
Need more information to reproduce the issue.
from jcf.
Having the same issue in Bootstrap 3. It is caused by jQuery outerWidth() behavior, it rounds the actual width. I managed to solve it in jcf.select.js, function repositionDropdown
(line 309):
selectWidth = this.fakeElement.outerWidth(),
replace it with
selectWidth = this.fakeElement[0].getBoundingClientRect().width,
(see stackoverflow to take care about browser support)
from jcf.
If you wish, I could make a pull request (browser-safe version of this comment).
from jcf.
Ok, so .offset()
already returns floating point value and only width is calculated with rounded values. I think this is the only place that needs to be updated in jcf.select module.
@nikolai-katkov will be waiting for your PR ;)
from jcf.
Related Issues (20)
- Wrong selectbox rendering after reset form with scrollable.js HOT 1
- full-text search for select box
- Keyboard Tab to switch to next form controll not working
- scrollable looses styling on ios
- Default number input with step 2 on touchpads
- Issue with custom scroll on iOS HOT 1
- programmatically close dropdown when going out of focus HOT 2
- Select options disappear after programmatically trigger hideDropDown HOT 2
- How to unbind element with JCF. HOT 1
- Can I turned off init jcf-scrollable on resize? HOT 1
- How can I do scrollTop? HOT 1
- How to hide the option from JCF dropdown when native select is hidden using method hide() HOT 1
- onchange of select HOT 1
- Have to use small hack with v-model checkboxes on vue.js 2.x HOT 1
- Selection popup dissapears after clicking on dropdown element in Firefox on mobile HOT 1
- How can I close select dropdown programmatically? HOT 2
- compatibility jquery 3
- How to exclude elements from rendering HOT 1
- Ajax loading HOT 3
- JCF js library does not allow smartphone wheels (IOS device ) on multiple selection select fields
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jcf.