Comments (14)
Ye, and FontAwesome actually have this SCSS:
$fa-css-prefix: crazyprefix;
.#{$fa-css-prefix}-spin { ...
So if an option - it would go into the SCSS + the JS options (must be same ofc.). Else just go with e.g. fap
(fancy app :D )
from ui.
Hi,
I like the idea about the prefix, I think I will add that as an option.
from ui.
You might want to revisit this. Many of the fancybox classes are not scoped such as is-hidden
. It would be helpful if you would scope everything as to not come into conflict with existing frameworks.
from ui.
You already can override all the classnames, it just takes a bit of a work.
In the options, you can do the following
classNames: {
viewport: "carousel__viewport",
track: "carousel__track",
slide: "carousel__slide",
slideSelected: "is-selected",
},
And alter as needed. You need to manually alter the styles after you do this though
Though it could be made a bit more clear, or maybe just set it in one place (some kind of prefix
option maybe, that would get copied across the board?)
Agreed on better prefix for Carousel
, that is rather generic, as opposed to Fancybox
and Panzoom
. Maybe something like fancyapps_carousel
, fancyapps_fancybox
, etc?
from ui.
I was more thinking of a generic prefix for all classes, could be fancyapps
- but fancyapps_fancybox__slide
sounds a bit... verbose :) But a prefix for the most generic would ok too / good enough I spose 👍
I just often find that class names quickly becomes to generic. Targeting the styles can be ok easy like wrap the whole SCSS import in a main class (although a bit bloated) - but that does not help if e.g. bootstrap (and its a bs discussion too I have seen) "bleeds out" across. And also a query selector like ".carousel"
will end up "getting too may". I am in an environment where I have no idea what else is there - even in the SCSS stack.
from ui.
Agreed that is a bit verbose, I was thinking about something that would not conflict with other stuff (just fa
sounds like related to FontAwesome, etc.)
from ui.
Honestly, naming was a very difficult decision. All common names are already taken (like Swiper), a random name would also confuse or would be hard to remember, fa-
(or f-
) prefix could be confused with Facebook or other projects.
On the other hand, Carousel needs very little CSS for basic functionality. You could easily set your custom names using JS options and then just write your CSS that you need.
from ui.
Naming always is ain't it! ;-) Well, as I am test running your v4 here - my decision is to base it on top of your SCSS files - cause just in case you add some sort of really important thing like css transform, overflow, grid/flex swap etc. that is crucial - then the JS and SCSS package update will take care of that..
from ui.
+1 for ALL class names used in this project to be namespaced (e.g. fb4-*) by default (or main classname namespaced and all other classes nested under it in scss/css).
Too many other libraries in use now-a-days to use non-namespaced class names. It you are worried about classname length, I would rather see the namespace and a less verbose classname.
Fancybox V4 class names should also be isolated from Fancybox V3 classnames for those migrating to avoid conflicts. Not sure if they are or not--- haven't jumped in that far yet.
.carousel, .compensate-for-scroll are common classnames.
from ui.
I am going to change naming in v5. Which option would you prefer? Maybe there are other suggestions?
.FancyPanzoom {} .FancyPanzoom__content {}
.FancyCarousel {} .FancyCarousel__slide {}
.FancyBox {} .FancyBox__content {}
OR
.fancy-panzoom {} .fancy-panzoom__content {}
.fancy-carousel {} .fancy-carousel__slide {}
.fancybox__container{} .fancybox__content {}
from ui.
Personally the latter.
And here is another suggestion - a bit shorter, split of fancybox
and with BEM --
for "state" (A):
.fancy_panzoom {} .fancy_panzoom-content {}
.fancy_carousel {} .fancy_carousel-slide {} .fancy_carousel-slide--active {}
.fancy_box-container{} .fancy_box-content {}
Or even shorter (B):
.f_panz {} .f_panz-content {}
.f_caro {} .f_caro-slide {} .f_caro-slide--active {}
.f_box-container{} .f_box-content {}
But anything goes :)
from ui.
Personally I prefer snake_case and/or kebab-case for naming stuff in projects over CamelCase
Maybe slight suggestion for sake of clarity, use fancy
as prefix always, including Fancybox (so something like fancy_box
, fancy_carousel
etc, if going with 🐍).
I like the first suggestion from @AndersMad, the second would probably run into problems of being too confusing with other libraries, as I mentioned before.
from ui.
Thanks for the suggestions. I will probably choose the simplest solution to add a prefix to all class names. Not sure which one to choose, maybe f-
would be fine - simple and short:
.f-panzoom {}
.f-panzoom__viewport {}
.f-panzoom__content {}
.f-carousel {}
.f-carousel__track {}
.f-carousel__slide {}
.f-fancybox__container {}
.f-fancybox__backdrop {}
.f-fancybox__slide {}
.f-fancybox__content {}
.f-fancybox__caption {}
from ui.
Hi,
So, v5 has been released recently and class names are prefixed with f-
except for Fancybox.
from ui.
Related Issues (20)
- Vimeo parameters have no effect HOT 3
- Mouse panning breaks zoom on Android (panMode: "mousemove") HOT 8
- Fancybox.getInstance is incorrectly typed, missing string option HOT 2
- Download button is disabled for videos HOT 2
- Aspect Ratio via data-attribute HOT 1
- Unable to click on a link positioned over a Fancybox/Carousel HOT 1
- Carousel error when trying to control slides using useState in React HOT 1
- Fancybox: Hide caption when idle? HOT 1
- iframe performance issue HOT 2
- Slideshows aren't waiting for videos anymore HOT 2
- Zoom doesn't work when image is max size HOT 1
- Carousel position resetting when toggling visibility (display none) HOT 2
- Vertical thumbnails? HOT 1
- SASS Deprecation Warning HOT 2
- Performance Issues and loosing state on Mobile HOT 7
- "Nested" Fancybox instance ignores "inline" type, using "clone" instead. HOT 1
- Carousel bug: data-lazy-srcset incorrectly assigned to src instead of srcset
- Carousel thumbs bug: Thumb src doesn't work on addSlide, prependSlide and appendSlide HOT 2
- Deceleration re-implementation? HOT 2
- Fade-in animation jump when backdrop opacity != 1 HOT 2
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 ui.