I am trying to use Vuetify components to achieve an effect on some v-img thumbnails and I am failing to do so. My images are setup as follows:
<v-row class="fill-height pa-5"
align-content="center"
justify="center">
<v-col class="text-subtitle-1 text-center"
cols="12"
sm="3">
<v-card>
<v-img :src="item.docs.doc1"
aspect-ratio=".77"></v-img>
</v-card>
</v-col>
<v-col class="text-subtitle-1 text-center"
cols="12"
sm="3">
<v-card>
<v-img :src="item.docs.doc2"
aspect-ratio=".77"></v-img>
</v-card>
</v-col>
<v-col class="text-subtitle-1 text-center"
cols="12"
sm="3">
<v-card>
<v-img :src="item.docs.doc3"
aspect-ratio=".77"></v-img>
</v-card>
</v-col>
<v-col class="text-subtitle-1 text-center"
cols="12"
sm="3">
<v-card>
<v-img :src="item.docs.doc4"
aspect-ratio=".77"></v-img>
</v-card>
</v-col>
</v-row>
I have these aligned horizontally in a row with columns and I am trying to have it so that when i over over each v-img they dim separately and a white solid v-button will appear in the center which I will assign a link/text too. What is the best way to do this as the hover component seems to lack dimming properties.
I don't think you are going to get this straight out the box but you don't need to do much more to get the result you want.
Out-the-box...
Use the Hover component to trigger an event and use the slot (boolean) value to toggle CSS class(es).
Template
<v-hover v-slot="{ hover }">
<v-card :class="{ 'on-hover': hover }">
// ...
</v-card>
</v-hover>
Custom...
Then add some scoped styles. The following is just a quick example but you can style however you like.
Styles
.v-image {
transition: filter .4s ease-in-out;
}
.v-card:hover .v-image {
filter: brightness(25%);
}
Example: https://codepen.io/alexpetergill/pen/NWBadjV
Docs: https://vuetifyjs.com/en/components/hover/
API: https://vuetifyjs.com/en/api/v-hover/#slots
Related
I am having issues aligning things correctly inside my Vue app using Vuetify.
<v-card class="mx-auto">
<v-row>
<v-col
v-for="(item, i) in items"
:key="i"
align-end
justify-end
>
<v-btn class="btn">
<v-icon>{{ item.icon }}</v-icon>
<span class="ml-2">{{ item.text }}</span>
</v-btn>
</v-col>
</v-row>
...
I simply want to align it to the right.
The properties you've put on <v-col> don't exist (i.e. align-end and justify-end). They are properties on the <v-row> component (which is a flex container). You need to use classes instead.
Make sure to consult the API->props section on the Vuetify component page when choosing component properties.
Try
<v-col class="d-flex justify-end">
<v-btn>Button</v-btn>
</v-col>
Note that the alignment is dependent upon the width of v-col. If v-col is only as wide as the button, you'll need to set the width by using the cols="x" property.
Add direction: rtl to your v-btn, Here is codepen:
<template>
<v-btn class="btn rtl">
...
</v-btn>
</template>
<style>
.rtl { direction: rtl; }
</style>
I am new to vuejs and i started with vuetifyjs. I am having problems with their layout.What i want to do is: i have four columns for example they have 4 width in the 12 layout grid. On same break point they will go one under another instead to be in same line
<template>
<v-container class="grey lighten-5">
<v-row class="mb-6" no-gutters>
<v-col v-for="n in 4" :key="n" cols="md-3">
<v-card class="pa-2" tile outlined>
col
</v-card>
</v-col>
</v-row>
<v-container>
</template>
But they have always same width:
I need something like in bootstrap:
col-md-4
they will have 4 width until 768px,below that the columns will be one under another.
Is this possible with vuetifyjs ?
The cols prop is to set the default number of columns. Then use on of the breakpoint props (sm, md, lg, ...) to set the number of columns at that breakpoint.
Therefore, for full-width columns on mobile, and 4 columns on md and larger:
<v-container class="grey lighten-5">
<v-row class="mb-6" no-gutters>
<v-col v-for="n in 4" :key="n" cols="12" md="3">
<v-card class="pa-2" tile outlined> col </v-card>
</v-col>
</v-row>
<v-container>
https://codeply.com/p/jhYKePIxal
Also note that Vuetify's breakpoints are different than Bootstrap's breakpoints. "Medium" is 960px > < 1264px*, and there isn't a 768px breakpoint.
In a Vue 2 SPA I use Vuetify. On the home page I have a carousel that auto cycles through 3 v-carousel-items. For the first cycle of the v-carousel the viewport jumps to the carousel on cycling. The desired behaviour is for the carousel to continue cycling but not to pull the viewport. Weirdly it happens in Chrome but not in Firefox. I found a similiar problem adressed in https://www.programmersought.com/article/15814769396/.
<v-carousel
progress
:progress-color="secondColorComputed"
interval=7000
cycle
height="750px"
class="mx-auto ; my-4 ;"
show-arrows-on-hover>
<v-carousel-item
transition="false"
reverse-transition="false">
<v-card width="90%" class="mx-auto ; black--text" shaped :color="colorComputed">
<v-card-title>Sub Seasonal Outlook</v-card-title>
<!-- <v-container fluid> -->
<v-row align="center" justify="center">
<v-card width="50%">
<v-img
alt="GIF 1"
class="shrink"
contain
src="https://hpfx.collab.science.gc.ca/~svfs000/na-vfsp-was/public/assets/geps/ss-precip.png"
width="800"/>
</v-card>
<v-spacer></v-spacer>
<v-card width="50%">
<v-img
alt="GIF 2"
class="shrink"
contain
src="https://hpfx.collab.science.gc.ca/~svfs000/na-vfsp-was/public/assets/geps/ss-temp.png"
width="800"/>
</v-card>
</v-row>
<!-- </v-container> -->
<v-btn :color="secondColorComputed" to="/forecasts/sub-seasonal-outlook">More</v-btn>
</v-card>
</v-carousel-item>
<v-carousel-item
transition="false"
reverse-transition="false">
<v-card width="90%" class="mx-auto ; black--text" shaped :color="colorComputed">
<v-card-title>Multi Model Ensemble 03H Continental USA</v-card-title>
<!-- <v-container fluid> -->
<v-row align="center" justify="center">
<v-spacer/>
<v-card width="75%">
<v-img
alt="GIF 1"
class="shrink"
contain
src="https://hpfx.collab.science.gc.ca/~svfs000/na-vfsp-was/public/assets/mme-pm25-combined/conUS-pm25-03.png"
/>
</v-card>
<v-spacer/>
</v-row>
<!-- </v-container> -->
<v-btn :color="secondColorComputed" to="/forecasts/multi-model-ensemble">More</v-btn>
</v-card>
</v-carousel-item>
<v-carousel-item
transition="false"
reverse-transition="false">
<v-card width="90%" class="mx-auto ; black--text" shaped :color="colorComputed">
<v-card-title>Fire Weather Index 24H</v-card-title>
<!-- <v-container fluid> -->
<v-row align="center" justify="center">
<v-spacer/>
<v-card width="50%">
<v-img
alt="GIF 1"
class="shrink mr-2"
contain
src="https://hpfx.collab.science.gc.ca/~svfs000/na-vfsp-was/public/assets/fwi/fwi-24.png"
width="800"/>
</v-card>
<v-spacer/>
</v-row>
<!-- </v-container> -->
<v-btn :color="secondColorComputed" to="/forecasts/fire-weather-index">More</v-btn>
</v-card>
</v-carousel-item>
</v-carousel>
I'm not sure if it's exactly the same issue as what you're having, but I had a problem with the page jumping up to the carousel on slide change, and managed to get it to stop doing this by setting the wrapper to have no height. (I'm using the fade animations.)
.v-window__container {
height: 0;
}
Mine issue got resolved by replacing transition to fade transition.
<v-carousel :cycle="true" interval="3000">
<v-carousel-item
v-for="(item,i) in items"
:key="i"
:src="item.src"
fade
></v-carousel-item>
I'm trying to create a web site (I'm a beginer in Vuetify ) , and I want to create a button at the extremity of the page(last row even in the center ,last column) , but this buttun still in the begin of the page , Here is my code :
<template>
<div>
<v-toolbar
dark
prominent
src="https://cdn.vuetifyjs.com/images/backgrounds/vbanner.jpg"
>
<v-app-bar-nav-icon #click.stop="drawer = !drawer"></v-app-bar-nav-icon>
<v-toolbar-title>Workers</v-toolbar-title>
</v-toolbar>
<v-row align="center">
<v-col cols="12" sm="6">
<v-btn x-large color="pink" >START</v-btn>
</v-col>
</v-row>
<v-navigation-drawer app
v-model="drawer"
.
.
.
</v-navigation-drawer>
</div>
</template>
PS: the collor of the button also doesn't change
Thank you !
I think this should do the trick.
<v-row class="align-center">
<v-col cols="12" sm="6" class="text-right">
<v-btn x-large color="pink" >START</v-btn>
</v-col>
</v-row>
When using v-row you can manipulate horizontal alignment using justify and vertical alignment using align like the official document points out.
For your case to align the button at the end:
<v-row justify="end">
<v-btn>Button</v-btn>
</v-row>
I am developing a team presentation page for an app with VueJs and Vuetify. I would like the picture and description of each member to be next to each other on desktop, but stacked on top of each other on small displays.
I used <v-col> to hold each of the two elements, which gives me what I want on large screens. Is there a canonical way to achieve the stack behaviour on small devices? I am aware of Vuetify breakpoints helpers but don't know how to use them in this case.
Here is the code I used for the components that wraps a person's presentation:
<template>
<v-container>
<v-row class="mb-6">
<v-col cols="2">
<v-img :src="member.elements.picture.value[0].url" height="12em"></v-img>
</v-col>
<v-col cols="8">
<v-container
class="text-justify body-1"
v-html="member.elements.description.value"
></v-container>
</v-col>
</v-row>
</v-container>
</template>
You just need to change the v-col width attribute from cols to multiple attributes lg and sm.
<template>
<v-container>
<v-row class="mb-6">
<v-col lg="2" sm="12">
<v-img :src="member.elements.picture.value[0].url" height="12em"></v-img>
</v-col>
<v-col lg="8" sm="12">
<v-container
class="text-justify body-1"
v-html="member.elements.description.value"
></v-container>
</v-col>
</v-row>
</v-container>
</template>
grid documentation