I am need paint my image. I'm trying use JQuery in here this link: http://davidlynch.org/projects/maphilight/docs/
When I am using mouseover does work, but I need when open page all images are painted without mouseover ?
how to do this ?
thanks.
$(document).ready(function()
{
$('.targetClass').mouseover();
}
Here you have demo doing almost exactly what you are asking for:
http://davidlynch.org/projects/maphilight/docs/demo_simple.html
Related
I have a Bootstrap carousel and an invisible div with a loading gif that I want to show while a big image is loading. I'd like to show this div only when I change the active image on the carousel and this image is still loading.
I've already got the HTML and CSS working, I just need an help with jQuery.
I fetch the images links from Imgur and then build the carousel-items that I need with jQuery and append them on the carousel container.
I then attached to the carousel event slide.bs.carousel a function that shows me the loader. and this works
BUT BUT BUT
I'm worried that the loader will show for few milliseconds even if the image is already loaded/cached. How can I prevent this? How can I know if the image that is becoming active is already loaded? Do I really need to worry about this or I just leave it like this?).
I then want to hide the loader when the active image is ready, and I've done this:
$('.carousel-item img').each(function(){
$(this).on('load', function(){
$("#loader_container").css("visibility","hidden");
});
});
But it doesn't work. Seems like this load even keeps firing until
all the images of the whole carousel are loaded, and also somehow
the loader doesn't hide in the end, and this is the issue n.2.
Probably I'm approaching this wrong.
Is issue n.1 really a problem? And how can I solve issue n.2?
Thank you!
EDIT 1:
I tried to do this but still doesn't work. When I slide to the next slide I see that the image is already loaded, then the loader appears and doesn't go away anymore.
$(".carousel-item img").each(function(index){
$(this).on('slid.bs.carousel', function(){
$("#loader_container").css("visibility","visible");
});
$(this).on('load', function(){
$("#loader_container").css("visibility","hidden");
});
$(this).attr("src",links[index]);
});
EDIT 2:
Also, it seems like the browser try to load all the images as soon as possible, even the ones that are not displayed/are not active items.
I'd like to load the images only if the user goes to that slide and makes the item active.
EDIT 3:
I've found a library name jquery.unveil.js that seems like it does exactly what I need and is super easy to use... but somehow it doesn't work.
Maybe AngularJS can help me? Anyone know how can I modify my code to do this with angular? Like using ngui-in-view?
$('.carousel-item img').each(function(){
$(this).on('slid.bs.carousel', function(){
$("#loader_container").css("display","none");
});
});
You can use the slide.bs.carousel and slid.bs.carousel instead
Solved with lazy loader, here the code:
$(".carousel.lazy").on("slide.bs.carousel", function(ev) {
var lazy;
lazy = $(ev.relatedTarget).find("img[data-src]");
if(lazy.length > 0){
$("#loader_container").css("visibility","visible");
$(".carousel-item img").on("load",function(){
$("#loader_container").css("visibility","hidden");
});
lazy.attr("src", lazy.data('src'));
lazy.removeAttr("data-src");
}});
I needed that if(lazy.length > 0) because once I did a full round of the carousel and all the images where loaded, somehow the loader would show up and never go away. I tried with if(img.complete) but it didn't work so I used that technique.
I want to show a movable popover with some links and info when someone move cursor over an image. I'm using Bootstrap 3.
Here is an example.... http://99designs.com/logo-design/contests/logo-design-naming-contest-25538/entries#contest-breadcrumbs
In this example when someone move the cursor over an image a popover has been appear.
I want to create something like this.
.............Sohag
try using tooltipster or you can create your own jquery function for this.
this link will help you.
tooltip image
tooltipster
if you are ready to pay $6, then this plugin is really very good.
codecanyon smart image tooltip
Try this
HTML
<img src="https://www.google.com/images/srpr/logo11w.png">
JavaScript
$("a.fancybox").fancybox({
'showCloseButton': false
}).hover(function() {
$(this).click();
$(".fancybox-overlay").mouseout(function() {
$.fancybox.close();
});
});
Demo
I really like this pure CSS gallery (explanation).
How do I change this code so that it doesn't preload all the pictures that show on mouseover/hover? Any lightweight javascript or similar that I can use instead? (or simple wordpress plugin).
It is important that the image that shows on hover is right above the thumbnail just like the example above and that it shows a separate image (no resize).
I have searched for days and I can't find any lightbox that does the same so hope someone can help me, thanks.
I would just use jquery, it would look something like,
<script>
$("thingtohover").hover(
function () {
$(this).append($("<span class='hovers'<img src=<'/path/to/img.jpg'")</span>);
},
,
function () {
$(this).find("span:last").remove();
}
</script>
I just want to click on the image and then see it blur out. That's it. Here is the link:
http://www.olliemccarthy.com/test/blur-experiment/
Here is the code I've been using so far.
$(document).ready(function() {
$('.test').click(function() {
$(this).("blurfast", {amount:0.8})
});
});
I've tried rearranging the order in which the scripts are called in and no luck.
$(this).pixastic("blurfast", {amount:0.8});
will do it. You forgot to call the jQuery method.
Here is the code I've been using so far.
[snip]
$(this).("blurfast", {amount:0.8})
That's invalid JavaScript syntax and should be throwing a parsing error.
According to the Pixtastic documentation, you want:
$(this).pixastic("blurfast", {amount:0.8});
...assuming that you want to blur the image that was clicked.
I am using this jQuery plugin
It is very nice, but I can't seem to figure out how to get it to auto-play. (automatically transition to the next image at an interval)
Has anyone else gotten this to do that?
$('#galleria').galleria({
extend: function() {
this.play(4000); // will advance every 4th second
}
});
Actually the new version of galleria has an option for autoplay. looks like this:
(where .test is the name of the div layer containing your images)
<script>
// Load theme
Galleria.loadTheme('../src/themes/classic/galleria.classic.js');
$('.test').galleria({
autoplay: 1000
});
</script>
In my experience, it doesn't have that option. You'd have to hack it to add that.
You might want to consider using another slider plugin: Easy Slider, Galleriffic, Pikachoose