It works fine with other buttons and elements I use on the page, but with the aside section that is on a fixed position. The tooltip shows up on the bottom. The next tooltip, for eksample for GitHub, shows up even further down.
I think it has something to do with the position in the CSS code, but I cannot figure it out. Is there anyone that has had the same issue and can help?
CSS:
aside {
background-color: #16123f;
position: fixed;
top: 40%;
padding: 10px 20px;
border-top-right-radius: 20px;
border-bottom-right-radius: 20px;
filter: drop-shadow(0px 3px 6px #00000045);
}
Code from the React component:
<aside>
<ul className="social">
<li>
<a data-tip data-for="ePost" href="mailto:stig.ark#gmail.com">
<FontAwesomeIcon icon={faAt} className="fa-solid fa-at fa-lg" />
</a>
<ReactTooltip
backgroundColor="#ed0b70"
textColor="black"
id="ePost"
place="top"
effect="solid"
>
Send meg en epost!
</ReactTooltip>
</li>
// ...
</ul>
</aside>
Here is how it looks, I want it right beside the aside.
I have managed to make it look like what you want with the following workaround (note overridePosition):
<aside>
<ul className="social">
<li>
<a data-tip data-for="ePost" href="mailto:stig.ark#gmail.com">
<FontAwesomeIcon icon={faAt} className="fa-solid fa-at fa-lg" />
</a>
<ReactTooltip
backgroundColor="#ed0b70"
textColor="black"
id="ePost"
place="top"
effect="solid"
overridePosition = {() => {return { left: 30, top: -40 };}}
>
Send meg en epost!
</ReactTooltip>
</li>
// ...
</ul>
</aside>
This is what it looks like now:
As for a proper fix, I do think this is a bug in the library. It may be a good idea to open an issue in its GitHub reposotory but unfortunately it's not reasonable to expect a fix anytime soon, considering that the library has more than 250 open issues already and the last commit was more than 3 months ago.
Related
Is there a way (preferably simple way)
wither in CSS twick or Jquery function to disable swipe finger touch on mobile only?
my case is that I have Bxslider enabled on a website
but on mobile I break down the float with CSS to show all slides (8) at once in a static way.
the problem is that the function is still running and when I swipe my fingers over the slider, even if it doesn't look like a slider anymore it moves the block of photos out of the viewport.
Anyway to just stop the swipe thing in mobile somehow?
Thanks
Have you tried touchEnabled: false?
Also oneToOneTouch: false for good measure.
$(function () {
var ss = $('.slideshow').bxSlider({
touchEnabled: false,
oneToOneTouch: false
});
});
.shell {
max-height: 300px;
max-width: 400px;
}
img {
margin: 0 auto;
}
<link rel="stylesheet" href="http://cdn.jsdelivr.net/bxslider/4.2.5/jquery.bxslider.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="http://cdn.jsdelivr.net/bxslider/4.2.5/jquery.bxslider.min.js"></script>
<section class="shell">
<ul class="slideshow">
<li>
<img src="http://placehold.it/666x375/000/Fff.png&text=FIRST" />
</li>
<li>
<img src="http://placehold.it/800x450/048/Fee.png&text=SECOND" />
</li>
<li>
<img src="http://placehold.it/720x404/fa8/375.png&text=THIRD" />
</li>
<li>
<img src="http://placehold.it/520x303/9a7/a10.png&text=FOURTH" />
</li>
<li>
<img src="http://placehold.it/640x360/fd3/b0d.png&text=FIFTH" />
</li>
<li>
<img src="http://placehold.it/480x270/fff/000.png&text=LAST" />
</li>
</ul>
</section>
I'm simply trying to make an image clickable and execute function.
Here is my code:
<button class="button button-stable button-clear" on-click="myFunction()">
<img src="image.png" >
</button>
But the function is not executing on the click event.
With angular you should use ng-click.
try ng-click="myFunction()"
you can do
<img src="image.png" ng-click="myFunction()" />
try put ng-click in <img>
For example
<img class="button " ng-src="{{i.imagem}}" ng-click="myFunction($index)"></img>
What you are looking for is event binding in Angular. Read more about this from Angular documentation.
<img [src]="yourVariable" (click)="yourFunction()">
You don't have to. With a little extra markup you can do this.
Wrap image in label
set for to a hidden button id
run js on button click
Doing this will be a more accessible solution for people with disabilities.
Use this html.
<!--html-->
<label for="image-click">
<img src="http://lorempixel.com/100/100" alt="" />
</label>
<button id="image-click"
onclick="myFunction()"
class="visuallyhidden">
Click to run image
</button>
And add some css.
//css
.visuallyhidden {
position: absolute;
overflow: hidden;
clip: rect(0 0 0 0);
height: 1px; width: 1px;
margin: -1px; padding: 0; border: 0;
}
label {
cursor: pointer;
}
Here is a codepen that shows how - http://codepen.io/bitlinguist/pen/bEJvoz
You can just as easily adopt this approach with angular directives.
How can i make this onsenUi dialog open as fullscreen? I have a image inside this dialog.
<ons-dialog style="width:305px;height:400px;" var="naviDialog" cancelable>
<ons-navigator var="myNav">
<ons-toolbar inline>
<div class="center">
text sample
</div>
</ons-toolbar>
<div class="dialog">
<p>
<img src="images/picone.png"/>
</p>
</div>
</ons-navigator>
</ons-dialog>
I've found a way
<ons-dialog style="width:100%; height:100vh;" var="naviDialog" cancelable>
In order to make it vary according to the image size I've done the following:
/* under CC0 waiver */
.dialog{
width: auto;
max-width: 90%;
}
.dialog img{
width: auto;
}
Hope it helps others
I have a shopping cart (a rootScope array) which gets turned into a list of items in it, including a button to delete that item from the cart array (the red X).
I don't have enough reputation to add an image, so here's a link to what it looks like
What I want to have happen is when I click one of the red X buttons, the item first does an animation(some sort of fade out), and then the actual cart has the item spliced from it. Using ng-click I am able to either do one or the other, but not both. When both is applied the animation doesn't trigger because it doesn't have time to. Is there a way to wait for the animation to finish, then perform the function?
(the animation executed by applying a class to the div on ng-click, so possibly a watch for class change?)
Here's my code. The code won't work in the snippet but you can see my functions and html.
$scope.removeFromCart = function(removedGame) {
index = $rootScope.cartArray.indexOf(removedGame);
$rootScope.cartArray.splice(index, 1);
};
$(".disappear").hasClass('fadeOutRight')(function(){
$scope.removeFromCart(cartArray[0]) ;
});
.cartGameDiv {
height: 140px;
width: auto;
}
<div ng-repeat = "newGame in cartArray" ng-class="disappear">
<div>
<div class="col-sm-11 col-lg-11 col-md-11 cartGameDiv">
<div class="thumbnail">
<div class="pull-left">
<img style="height: 100px; width: 213px; padding: 5px; margin-top: 5px" src="{{newGame.thumbnail}}" alt="">
<div id="ratingDiv" style="margin-left: 8px; margin-right: 8px; margin-bottom: 5px;">
<div style="display: inline-block" ng-bind-html="getTrustedHtml(newGame)"></div>
<p class="pull-right" style="color: #d17581">{{newGame.numberReviews}} reviews</p>
</div>
</div>
<div class="caption">
<h4 style="margin-top: 0" class="pull-right">{{newGame.price}}</h4>
<h4 style="margin-top: 0"><a class="categoryGameName" href="#details/{{myGamesList.indexOf(newGame)}}">{{newGame.name | removeSubName}}</a>
</h4>
<p>{{newGame.description.substring(0,290) + '...'}}</p>
</div>
</div>
</div>
</div>
<div class="col-sm-1 col-lg-1 col-md-1 cartGameDiv">
<img style="margin-bottom: 10px; margin-top: 10px;" src="images/glyphIconCheckmark.png" alt=""/>
<img ng-click="disappear='animated fadeOutRight'; removeFromCart(newGame)" style="margin-bottom: 10px" src="images/glyphIconRemoveGame.png" alt=""/>
<img src="images/glyphIconLike.png" alt=""/>
</div>
</div>
If you have any idea how to delay the function call until after the animation I'd really appreciate it! Thanks!
This is very simple to do using ngAnimate. Add the ngAnimate script to your page (you can get this from numerous CDNs), include ngAnimate as a dependency to your module and then just add some simple CSS.
.ng-leave{
-webkit-animation: fadeOutRight 1s;
-moz-animation: fadeOutRight 1s;
-o-animation: fadeOutRight 1s;
animation: fadeOutRight 1s;
}
In your example, you need not do any work applying the class yourself, ngAnimate will do it for you.
Here is a Plunker demonstrating how you would do it.
I am trying to perform a simple ng-repeat on an <li>. In the past, i have created vertical ng-repeat. I am now trying to create a horizontal one, however, one that displays 4 items, then starts the ng-repeat again on a new line.
The way i have gone about this is using the grid-wrap technique (CSS) found here: http://builtbyboon.com/blog/proportional-grids
So each <li>, has a CSS class/width of one-quarter (25%).
Is this the correct/Angular way of going about it? Or should i be using some kind of $index on the <li> and triggering a <br> when $index == 3 ?
HTML:
<div ng-controller="MainCtrl">
<ul class="grid-wrap one-whole">
<li ng-repeat="product in Products" class="grid-col one-quarter">
<div class="product-container">
<div>{{ product.ModelNo }}</div>
<img ng-src="{{product.ImgURL}}" width="80%"/>
<div>${{ product.Price }}</div>
</div>
</li>
</ul>
</div>
CSS:
.grid-wrap {
margin-left: -3em;
/* the same as your gutter */
overflow: hidden;
clear: both;
}
.grid-col {
float: left;
padding-left: 3em;
/* this is your gutter between columns */
width: 100%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.one-quarter {
width: 25%;
}
Here's my plunkr: http://plnkr.co/edit/REixcir0gL0HGCTvclYN?p=preview
Any other improvements you see feel free to add.
Thanks
I did some research and found this answer:
Customize ng-repeat in AngularJS for every nth element
<div class="section">
<div ng-repeat="items in MyList">
<img ng-click="AddPoint($index)" src={{items.image}} />
<span>{{items.currentPoint}}/{{items.endPoint}}</span>
<br ng-if="!(($index + 1) % 4)" />
</div>
So you could use this:
<br ng-if="!(($index + 1) % 4)" />
There doesn't seem to be a better way. You probably can't get around using index.