In this carousel,
how do I show dots?
<amp-carousel layout=fixed-height height=400 type=slides autoplay controls loop arrows dots='.'>
<amp-img src="img/slaid.jpg" layout=fixed-height height=400></amp-img>
<amp-img src="img/slaid.jpg" layout=fixed-height height=400></amp-img>
</amp-carousel>
There is an example in this codelab:
https://codelabs.developers.google.com/codelabs/advanced-interactivity-in-amp/index.html
The final code is here:
<amp-carousel type="slides" layout="fixed-height" height=250 id="carousel" on="slideChange:AMP.setState({selected: {slide: event.index}})">
<amp-img width=200 height=250 src="./shirts/black.jpg" [src]="shirts[selected.sku].image"></amp-img>
<amp-img width=300 height=375 src="./shirts/black.jpg" [src]="shirts[selected.sku].image"></amp-img>
<amp-img width=400 height=500 src="./shirts/black.jpg" [src]="shirts[selected.sku].image"></amp-img>
</amp-carousel>
<p class="dots">
<span [class]="selected.slide == 0 ? 'current' : ''" class="current"></span>
<span [class]="selected.slide == 1 ? 'current' : ''"></span>
<span [class]="selected.slide == 2 ? 'current' : ''"></span>
</p>
https://github.com/googlecodelabs/advanced-interactivity-in-amp/blob/master/static/final.html
Navigational dots can be added by indicating it in the CSS Custom Properties, <style></style>. Here's a Github sample from Styling/Theming with AMP:
<head>
<style>
amp-carousel {
--arrow-color: green;
--dots: {
opacity: 50%;
color: blue;
}
}
</style>
</head>
<body>
<amp-carousel width=500 height=500>
<div>
<amp-img width=500 height=500 src="https://placekitten.com/g/500/500">
</amp-img>
</div>
<div>
<amp-img width=500 height=500 src="https://placekitten.com/g/500/500">
</amp-img>
</div>
</amp-carousel>
</body>
You can also check this SO thread for additonal reference.
Related
I don't know how to express the CSS code below using elm-css.
input[name="tab_item"] {
display: none;
}
<div>
<input type="radio" name="tab_item">
<label>hoge hoge</label>
</div>
[data-short-caption="itemName" i] .circle-base,
this selector is identifying two items in the DOM, I need to select the second item, is there any way like we have in xpath to select the second item ?
The HTML Structure is something like this :
<div class="selection" data-select-item="select-item">
<div data-short-caption='itemName'>
<div class=circle-base> </div>
</div>
<div data-short-caption='itemName'>
<div class=circle-base> </div>
</div>
</div>
As per the HTML:
<div class="selection" data-select-item="select-item">
<div data-short-caption='itemName'>
<div class=circle-base> </div>
</div>
<div data-short-caption='itemName'>
<div class=circle-base> </div>
</div>
</div>
To identify only the second item you can use either of the following css-selectors based Locator Strategy:
Using nth-child():
div.selection div:nth-child(2) > div.circle-base
Using nth-of-type():
div.selection div:nth-of-type(2) > div.circle-base
If I could correctly understand your query, there are several ways to achieve it via css pseudo-selectors. Please check the code if it helps.
/*Method 1 : using last-of-type pseudo-selector*/
[data-short-caption="itemName" i]:last-of-type .circle-base{
background-color: #efefef;
}
/*Method 2 : using last-child pseudo-selector*/
[data-short-caption="itemName" i]:last-child .circle-base{
background-color: #efefef;
}
/*Method 3 : using nth-of-type pseudo-selector*/
[data-short-caption="itemName" i]:nth-of-type(2) .circle-base{
background-color: #efefef;
}
/*Method 4 : using nth-child pseudo-selector*/
[data-short-caption="itemName" i]:nth-child(2) .circle-base{
background-color: #efefef;
}
<div class="selection" data-select-item="select-item">
<div data-short-caption='itemName'>
<div class=circle-base> first child </div>
</div>
<div data-short-caption='itemName'>
<div class=circle-base> second child </div>
</div>
</div>
i want to check value in input if has any value in input i want to add class sh-is-active to a div using VUE but i don't know how... please help me
<template>
<div class="sh-wrap sh-wrap-input sh-is-active">
<label class="sh-label">First and Last Name</label>
<input type="text" class="sh-form-control sh-input" placeholder="First and Last Name" />
<span for="email" class="error">Required</span>
</div>
</template>
You can use v-model bind a value to the input and to dynamically add the classes :class="{ 'sh-is-active': name }". Read the official docs on how to bind classes and styles
new Vue({
el: '#example',
data() {
return {
name: null
}
}
})
.sh-wrap-input {
padding: 1rem;
border: 1px solid gray;
}
.sh-is-active {
background: yellow;
}
.sh-label {
display: block;
margin-bottom: .125rem;
}
.error {
display: block;
color: red;
font-size: 12px;
margin-top: .125rem;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="example" class="sh-wrap sh-wrap-input" :class="{ 'sh-is-active': name }">
<label class="sh-label">First and Last Name</label>
<input v-model="name" type="text" class="sh-form-control sh-input" placeholder="First and Last Name" />
<span v-if="!name" for="email" class="error">Required</span>
</div>
to check if value exists you can add :value="inputValue"
and watch for it using
watch: {inputValue: function(value){
"add your class here"
}}
<newsfeed-view inline-template :newsfeed="{{ $feed }}">
<article class="bg-white p-8 w-1/2 mt-4 p-4" id="newsfeedPost" v-bind:class="{ 'active' : isHighlighted } ">
<h3>
{{ $feed->newsfeed_title }}
</h3>
<p class="mt-4">{{ $feed->body }}</p>
</article>
</newsfeed-view>
This is my style section
<style lang="scss" scoped>
.highlighted {
#apply .border-l-4 .border-orange ;
}
#newsfeedPost {
#apply .rounded-lg ;
}
</style>
I want to add the highlighted class if I click on that anchor tag..
Your line v-bind:class="{ 'active' : isHighlighted }" will toggle the active class. If you want to toggle the highlighted class as dictated in your stylesheet, use:
v-bind:class="{ 'highlighted' : isHighlighted }"
I tried tweaking the CSS coding and no prevail. Things i want:
search box with border radius of 5px
enlarge the search icon with out getting it dispalced
both search box and search icon evenly placed around the div
HTML CODE:
<div class="search"
<div class="searchbox">
<form action="/search" method="get" class="search_form">
<input type="text" value="Search Blog..." class="search_text" name="q">
<input type="image" src="http://s25.postimg.org/d3fu892zz/search_button_without_text_md.png" height="20" width="20"class="button">
</form>
</div>
</div>
CSS CODE:
.search{position:fixed;
height:25px;
width:194px;
top:189px;
left:14px;
border:2px solid black;
background-color:black;
border-radius:10px;
padding-left:2px;
padding-bottom:4px;
opacity:.8;}
Notice: Your class="search" div is not closed !!
Here is the code that should work and fullfill all the three conditions of yours
<div class="search">
<div class="searchbox">
<form action="/search" method="get" class="search_form">
<input type="text" value="Search Blog..." class="search_text" name="q">
<input type="image" src="http://i42.tinypic.com/fayl43.png" class="button">
</form>
</div>
Css Code:
.search{position:absolute;
height:28px;
width:190px;
top:140px;
left:100px;
border:2px solid black;
background-color:black;
border-radius:10px;
padding-left:2px;
padding-bottom:4px;
opacity:.8;
}
form#input{
display:inline-block;
}
.searchbox{
}
.search_text{
margin-top:4px;
margin-left:5px;
border-radius:5px;
text-align:center;
}
.button{
margin-top:5px;
margin-left:2px;
position:absolute;
height:20px;
width:20px;
}
.button:hover{
-webkit-transform:scale(1.3);
-moz-transform:scale(1.3);
-o-transform:scale(1.3);
opacity: 3;
}
Working JSfiddle Demo - http://jsfiddle.net/vg8Mn/
Hope this helps :)