Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
famous-carousel
Advanced tools
A responsive carousel / slideshow / slider powered by Famo.us. Supports mouse, touch/swipe and keyboard navigation.
UPDATE: 0.9.x introduces ES6 and a new require() path:
CommonJS:
var famousCarousel = require("famous-carousel").Carousel;
var carousel = new famousCarousel( {...} );
Global:
var carousel = famousCarousel.default( {...} );
If you see any unusual behavior after upgrading, delete node_modules and run npm install again
After cloning the repo:
npm install
Start the example project at port 8080:
npm run example
famous-carousel uses Browserify require. Refer to the example folder for boilerplate setup. When using this as an npm module, reference it as such:
var Carousel = require("famous-carousel").Carousel;
var myCarousel = new Carousel("myDivSelector", {
// add options here
// ...
}
);
import { Carousel } from "famous-carousel";
The following keys are supported in the options object. Only carouselData is required, all others are optional.
Type: String
or Object
Default: body
As a string, selector is a CSS selector of the element to render into.
As an object, selector is assumed to be a Famous node.
Type: Array
This specifies the content of the slides. It is an array of objects, each containing type and data keys.
type may be image
, markup
, or node
.
data must be a url for image, any valid html for markup, or a Famo.us node object.
Example data:
[
{ "type": "image",
"data": "http://myDomain/myPicture.jpg"
},
{ "type": "markup",
"data": "<div style='color:blue'>Hello World<BR><BR>It's me!</div>"
},
{ "type": "node",
"data": myFamousNode
}
]
Type: Function
(node, index)
Callback fires when a slide starts to move into the center position. Parameters (node, index) are the slide's node and its corresponding carouselData index.
Type: Function
(node, index)
Callback fires when a slide has finished settling in the center visible position. Parameters (node, index) are the visible slide's node and its corresponding carouselData index.
Type: Integer
Default: 0
Initial slide number to show (zero-based). If larger than the number of slides, it will cap to the final slide.
Type: Boolean
Default: false
By default, navigation stops at the ends of the slide set. Setting wrapAround to true allows navigation to wrap from one end to the other.
Type: Integer
Default: 0
Automatically transition slides, pausing on each slide for the number of milliseconds specified. When the user navigates manually, automatic playback stops.
Type: Integer
Default: 1
Number of slides to advance during automatic playback.
Type: Integer
Default: 1
Number of slides to advance when user navigates.
Type: Integer
Default: 10
Width of dots along bottom.
Type: Integer
Default: 5
Spacing of dots along bottom.
Type: String
Default: "white"
Navigation dot foreground color (CSS style).
Type: String
Default: "transparent"
Navigation dot background color (CSS style).
Type: Float
Default: 1.0
Navigation dot opacity (CSS style).
Type: String
CSS class to style the selected dot. This overrides the other dot* CSS options (dotWidth & dotSpacing continue to be honored).
Type: String
CSS class to style unselected dots. This overrides the other dot* CSS options (dotWidth & dotSpacing continue to be honored).
Type: String
Default: "white"
Navigation arrow fill color (CSS style).
Type: String
Default: "transparent"
Navigation arrow outline color (CSS style).
Type: String
CSS class to style dots. This overrides the other arrow* CSS options.
Updates the slide data. This calls clearSlides() to reinitialize the slides. There is an issue with the dots not re-rendering properly.
Removes the slides.
Removes the carousel instance entirely. NOTE: Famo.us 0.5.2 has a bug causing it not to remove the DOMElement. famous-carousel removes the div.famous-dom-renderer element for now.
To build a self-contained bundles:
$ npm run build
Builds
CommonJS version (dist/famous-carousel.min.js)
global version (dist/global/famous-carousel.min.js), and global debug version (dist/global/famous-carousel.debug.js).
The global build uses the variable name famousCarousel.
To see the global version in action open browser to local port 8080/global.html after:
$ npm run example
To build optional es5 code:
$ npm install -g babel
$ npm run build-es5
Run tests (linter & style checks for now):
npm run test
Q: The arrows & dots show, but the slides are invisible.
A: famous-carousel sizes to its container's dimensions. Due to CSS box model rules, if no height is specified for the container, the default auto height computes to 0. Short answer: set a height for its parents all the way up to the root element.
Q: The slides appear from outside the containing element when animating.
A: Set the container's overflow property to hidden. Additionally center the famous-carousel within the containing element using these properties:
.myContainerClass {
overflow:hidden;
position:absolute;
left:0; right:0;
top:0; bottom:0;
margin:auto;
}
Q: The arrows/dots aren't visible [against a white backgound].
A: dotBackColor and arrowOutlineColor default to transparent. Set them to a different color.
Q: The slides are shifted down and to the right.
A: The selector element must not have any padding. The work-around for this Famous engine bug is to wrap the selector element in a container element which has the padding. Remove all padding from the selector element. See example/index.html for... an example.
Pull requests are welcome. When submitting a PR, please make sure npm run test passes.
This project is based on the Famo.us Carousel tutorial and bound by the same MIT license. Refer to the LICENSE file.
FAQs
Carousel built on Famo.us
We found that famous-carousel demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.