Unslider carousel "animation: 'fade'" - carousel

I'm trying to make a carousel with http://unslider.com like this:
$('.carousel').unslider({
autoplay: true,
speed: 750,
delay: 3000,
nav: false,
infinite: true,
arrows: {
prev: '<div class="prev-btn"></div>',
next: '<div class="next-btn"></div>'
}
})
All slides became invisible when i added the option animation: 'fade'. I cannot figure out why.
http://codepen.io/tjeu-kayim/pen/EgYYXN

I found the answer myself:
Add the css .unslider-fade {height: 100%} and the slides wil show up.

Sadly, the answer to this problem as to this date is to set a height to the unslider container. The GitHub repo of the unslider project has many questions regarding this issue, but all the answers are "add a widht and height to the container".
I guess the best css selector to use would be .unslider-fade, and I suggest you add your own class to the slider too, so it would end up looking something like .unslider-fade.your-class{height:###px;}; that way you will only affect the slider with fade in your website, in case you have any other slider working with the horizontal or vertical animation (or images with some other height).

Change your javascript a little bit:
$('.carousel').unslider({
autoplay: true,
speed: 0, //change this line(previously 750)
delay: 3000,
nav: false,
infinite: true,
arrows: {
prev: '<div class="prev-btn"></div>',
next: '<div class="next-btn"></div>'
}
})
And add this to css:
.carousel ul li {
opacity: 0;
-webkit-transition: opacity .75s; // if you want 750ms
transition: opacity .75s; // if you want 750ms
}
.carousel ul li.unslider-active {
opacity: 1;
}
And that's it, now you have "fade" effect. Enjoy!

Related

How i can use Freemode with Autoplay? [Marquee]

Im trying to do swiper marquee.
But I only found a solution with .swiper-wrapper { transition-timing-function: linear; } which doesn't work well with loop and safari IOS.
It is logical to assume that autoplay with delay:0 and freemode should create something similar to marquee, but alas, this does not work.
Are there any other ways to make a marquee swiper?
I tried this code and expecting marquee:
` const sliderInstance = new Swiper(root, {
...defaultOptions,
modules: [FreeMode, Autoplay],
init: false,
slidesPerView: 2.2,
loop: true,
freeMode: true,
spaceBetween: 8,
autoplay: {
delay: 1000,
disableOnInteraction: false,
},
});`

How to change vue-toasted pop-up direction

I'm using vue-toasted to show notifaction.
By default, it pops down to top.
Code:
<v-btn #click="onTest" />
...
onTest() {
this.$toast.info('Test!', {
containerClass: 'toasted-container',
className: 'toasted',
keepOnHover: true,
})
},
nuxt.config.js:
toast: {
duration: 3800,
action: {
icon: 'mdi-close-circle',
onClick: (e, toastObject) => {
toastObject.goAway(0)
},
},
iconPack: 'mdi',
icon: 'mdi-check-circle',
},
The toast pops down to top.
I tried to add some css like transition.
I'm not familiar with CSS, so I guess it's wrong.
How can I change it to right to left?
I couldn't find any info on their GitHub.
vue-toasted v1.1.27 only supports animating upward or downward. It has no API to add new animations.
I added some #keyframes and animation, it worked.
#keyframes in {
0% {
opacity: 0;
left: 100%
}
100% {
opacity: 1;
left: 0%
}
}
.some-class{
animation: in 300ms;
}

Swiper nested inside display:grid css

I'm battling the calculated width, with swiperjs.
I have have my slider working, however I'm trying to place it inside a container I created with CSS grid that has 2 columns, and 2 rows where the swiper is going into the 2nd row and it spans two columns. However the width calculations are astronomically large. I happen to notice that it's calculation also gets bigger if I resize the window.
nothing to special with my settings either... like I said it works when it's not in my row.
https://codepen.io/Johndgraham/pen/VwvmmZL
Any thoughts are appreciated.
var swiper = new Swiper(".swiper-container", {
slidesPerView: 1,
spaceBetween: 10,
// init: false,
pagination: {
el: ".swiper-pagination",
clickable: true
},
breakpoints: {
576: {
slidesPerView: 2,
spaceBetween: 20
},
992: {
slidesPerView: 3,
spaceBetween: 40
},
1200: {
slidesPerView: 4,
spaceBetween: 40
}
}
});
I resolved sizing issues with Swiper inside grid by setting .swiper-container and .swiper-wrapper to have display: inherit;
I also set .swiper-slide to have display: inherit; width: auto !important; max-width: 100% !important
I ended up changing the placement of my css grid to work around this, and now have it working nested.
I may take some time later to test out if it's the CSS grid that was causing the issue.
I came across the same issue and I've fixed by setting min-width: 0 to the grid items.
I've found the solution on this thread: Prevent content from expanding grid items

Blurred background in list sencha touch

I have a list which contains main menu of my mobile app and is visible when user swipes to right or clicks on menu icon. I want to have the background of this list and hence main menu to be blurred.
I checked out the css filter:blur property and it can be done using that but you need to have an extra div under the div which has your content and apply filter:blur to it as shown in this Codepen
Below is my list code for sencha touch
Ext.define('MobileApp.view.SlideList', {
extend: 'Ext.List',
xtype: 'slidelist',
config: {
cls: 'slide1',
variableHeights: true,
onItemDisclosure: true,
store: 'SlideListStore',
itemTpl: ['<div class="slideImg" style="background-image:url(resources/images/{img});"></div>',
'{title}',
'<div class="settingImg" id="settingImg" style="background-image:url(resources/icons/nw-icons/settings.png);"></div>'].join(''),
listeners: {
initialize: function (comp, eOpts) {
comp.element.on(
'swipe',
function (event, node, options, eOpts)
{
/*send event as a argument to get direction of swipe*/
this.fireEvent('swipe', event);
},
comp
);
}
}
}
});
I cant figure out where to place the extra div and apply filter:blur to it. Any pointers will be helpful.
Is this what you were trying to achieve https://fiddle.sencha.com/#fiddle/4tb
Here is how you can accomplish this
Add an empty div as html property of the list
remove the background of the list
add css to blur the image
.setMyBackground {
position: fixed;
left: 0;
right: 0;
display: block;
background-image: url('http://666a658c624a3c03a6b2-25cda059d975d2f318c03e90bcf17c40.r92.cf1.rackcdn.com/unsplash_527bf56961712_1.JPG');
width:100%;
height: 100%;
-webkit-filter: blur(5px);
-moz-filter: blur(5px);
-o-filter: blur(5px);
-ms-filter: blur(5px);
filter: blur(5px);
z-index:-1;
}
.slide1{ background:none;}

How to reduce sencha touch 2 list item height

How to reduce the height of list item in Sencha touch 2? My list showing large numbers of single word name/value pair. As each item taking extra height, list is becoming too long. So i want to reduce each item height to exact content height. I tried using css like this but no luck. Any help?
var tabPanel=Ext.create('Ext.TabPanel', {
fullscreen: true,
tabBarPosition: 'top',
defaults: {
styleHtmlContent: true
},
items: [
{
title: 'DETAILS',
xtype: 'list',
cls: 'myList',
....
itemTpl: '<table><tr><td>{fieldName}</td><td>{fieldValue}</td></tr></table>',
.............
.myList .x-list-item {
max-height: 30px;
}
Each list item has a min-height of 2.6em. So, you can reduce that and add a overflow property. Use this:
.my-list .x-list-item .x-list-item-label{
min-height: 0.8em !important;
overflow : auto;
}
And it is not a good practice to use Html tables inside itemTpl. Use plain DIV elements with -webkit-box CSS3 property.
You can use itemHeight config of list. http://docs.sencha.com/touch/2-1/#!/api/Ext.dataview.List-cfg-itemHeight
in addition to that you can also use CSS like this to control padding:
.my-list .x-list-item .x-list-item-body{
min-height: 0.5em !important;
padding-top: 0.3em;
padding-bottom: 0.3em;
}
use a property called as
itemHeight: [*Height of the item you need*],
i.e
itemHeight: 40
Read it from the Component's JS file