Custom Fancybox gallery - fancybox

I am using fancybox to load all images in my application. As of now, i am creating my own methods for Next & Previous links and not using fancybox ones. The output is like this.
http://imgur.com/a/TFq2N#0 (Desired output)
But the only problem is, upon clicking, i am changing the images, which is taking some time.
Now, i want to use fancybox gallery, because i have all URLs and titles with me in an json array. So i did something like this and now i am getting this as output. (http://i.imgur.com/JNfmz.png)
All i want is, The (desired output) with images much easier to load.
$.fancybox([{href : 'image.jpg', title : 'Lorem lipsum'},{href : 'image.jpg', title : 'Lorem lipsum'}]);
Can i make it look like my desired output, means can i add custom content?

Related

fancybox disable image preloading

Started to try out this fancybox3 plugin to zoom thumbnail images in our app that works perfectly on desktop and mobile browsers.
In the app where the cart has thumbnail images of the products added to it that can be purchased. If I remove a product(image of it)from the cart, it gets removed from the cart, however, if I zoom one of the remaining product images of the cart and navigate through it, still showing the removed product there. I am expecting to see only the product images present in cart.
I tried using the preload: 0 option but that does not work for me. Fancybox is initiated in following way
$('[data-fancybox="images"]').fancybox({
idleTime : false,
loop: true,
transitionEffect : "fade",
animationDuration: 333,
buttons: [
'close'
],
protect: true,
infobar: false,
preload: 0
});
Any help to make this work is really appreciated.
Thank you
Looks like you have misunderstood the concept of "preloading". The script preloads images before displaying, but what that means is that it is showing loading icon before displaying full image. If you disable preloading and provide dimensions (width/height) of full image, then the script will display thumbnail image while full image is loading. This is a great feature if you want to make your app/webpage look more interactive (e.g., user would not stare at black overlay with loading icon but will see something useful instead).
But what you have described sounds like "caching" and fancyBox is not caching dom elements. So, if you see something in the gallery, that means that corresponding element exists in your page.
So, make sure that your product is actually removed from the dom or try to tweak the selector to match only "actual" products using "selector" option, e.g., something like:
$().fancybox({
selector : '.fancybox:not(.removed)'
});
Obviously, you should tweak this to suit your needs. Since you have not provided any details, I can not create a full example.
#Janis, Thank you so much for the clarification on 'preloading' concept.
You were right about dom still holding the removed item. Upon removal, the div is simple being set as display none.
First, I added code to remove the div form the dom but that resulted in page getting refresh which we don't want.
Next tried, the selector option and it worked perfectly.
function hideCartItem(id) {
var divItem = document.getElementById("divCartItem" + id);
var elem = "#divCartItem" + id
if (divItem != null) {
$(elem).hide();
$(elem).remove();
// added code
$('[data-fancybox="images"]').fancybox({
divItem: '.fancybox:not(.removed)'
});
}
}
Thank you so mcuh for your help. Much appreciated!!

Fancybox Gallery AND Custom Titles

I want to enter custom HTML as the title, like this:
$(".fancybox").fancybox({
padding: 0,
title: 'Hello'
});
...but I also want a gallery of images.
I don't think you can have both as each gallery should use the same code above, but each unique title needs a separate implementation of the above code. Is this possible?
Also, is there a better way to set say 20 images, all in the same gallery and all with custom title content. At the moment I'm guessing I would need to specify each one individually using this code:
$("#fancybox-number-1").fancybox({
padding: 0,
title: 'custom-title-1'
});
(...but of course the gallery won't work and even if it did, specifying this 20 times sounds bad practice to me.)
How do I specify custom title, and have a gallery of 20 or so images in the best way possible?

Fancybox display error

Ey people
i recently designed a popup html file that's being called through fancybox inside my magento-template.
It works fine for all the pages except the homepage where it appears dislocated at the end of the page instead of appearing in the center of the window.
Firebug isnt having any errors for me and i,being a newbie, dont know where to look.
Some pointings,anyone?
Thanks
You are loading 3 instances of Fancybox :
http://www.tapet-online.ro/skin/frontend/default/acumen/js/jquery.fancybox-1.2.5.pack.js
http://www.tapet-online.ro/skin/frontend/default/acumen/fancybox/jquery.fancybox-1.3.4.pack.js
http://www.tapet-online.ro/skin/frontend/default/acumen/fancybox/jquery.fancybox-1.3.4.js
you only need a single one, may be this:
http://www.tapet-online.ro/skin/frontend/default/acumen/fancybox/jquery.fancybox-1.3.4.pack.js

How do I clear the opengraph's image tag proxy cache?

I have a page with og tags (including a source and an image - a youtube-like video view page).
I've replaced the image the og:image tag points to, to another image by the same name. However, when using the facebook linter/debugger, the image shown is the old image, while clicking the image itself, opens and shows the new image.
Facebook uses some kind of a proxy cache for the content of the image - how can I clear it without changing the name of the image file ?
This thread gives an answer.
To reiterate (in case thread goes down),
Go to http://developers.facebook.com/tools/debug
Enter the URL (of the page that holds your og meta tags) and include the query data: fbrefresh=CAN_BE_ANYTHING
e.g. http://www.example.com/mypage.html?fbrefresh=CAN_BE_ANYTHING
Using the debugger/linter should force a full recache. I suspect the caching you're seeing is in your browser. Have you tried emptying your cache or using incognito mode?
If that doesn't work (and depending on how much traffic you're getting) it might have something to do with the names being the same - but I don't think this should be the case. Try replacing the image with another with a different name, hit the URL in the debugger so FB receives the new one, then swap back to the one you want. Kinda janky, but will probably do what you want.

Pulling image path from animation [duplicate]

This question already has an answer here:
Fetching image From Animating UIImageView
(1 answer)
Closed 9 years ago.
I have a standard image animation for a simple banner. I'm trying to make it clickable so when the user clicks on the banner(a featured article list), it takes them to that article.
To achieve this in our Android version, we have a runnable that allows us to change both the image resource and the reference link at the same time.
I have the animation set up like this:
mBannerImageView.animationImages = newArray;
mBannerImageView.animationDuration = 10;
mBannerImageView.animationRepeatCount = 0;
mBannerImageView.startAnimating;
Is there a way/how can I pull the resource name from the image view at the current time? My thought is to have the IBAction for it to pull the resource and direct you from there(matching the image name to something saved in our coredata). If there isn't a way, what would be the best approach for something of this nature?
Thanks for the help!
If you wish to set up image animation, so I have some html code which through you are easily generate image animation. The steps below show you how to create a image animation.
Create a simple animation and save the images as a series of JPG images.
Build an HTML page with the image displayed somewhere on the page using the tag.
Save the file as logo1.htm. Within the tag, include a tag that looks like this:
With the HTML file still open, change the tag so that it displays the second frame of your animation, and change the tag to open logo3.htm and save the file as logo2.htm.
Repeat this process for all frames of the animation.