Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
according to this link
i can open fancybox with text
$.fancybox.open('<div class="message"><h2>Hello!</h2><p>You are awesome!</p></div>');

but this code does not show images just say
"The requested content cannot be loaded.
Please try later"
$.fancybox.open([
	{
		src  : '1_b.jpg',
		opts : {
			caption : 'First caption'
		}
	},
	{
		src  : '2_b.jpg',
		opts : {
			caption : 'Second caption'
		}
	}
], {
	loop : false
});


What I have tried:

work fine
$.fancybox.open('<div class="message"><h2>Hello!</h2><p>You are awesome!</p></div>');

not working
$.fancybox.open([
                {
                    src: '/0TestFancyBox/clock.png',
                    type: 'image',
                    opts: {
                        caption: 'First caption'
                    }
                },
                {
                    src: '/0TestFancyBox/flowers.png',
                    type: 'image',
                    opts: {
                        caption: 'Second caption'
                    }
                }
            ], {
                loop: false
            });
Posted
Updated 9-Dec-21 22:58pm
v2
Comments
CHill60 10-Dec-21 4:50am    
What if you add data-type="image"Also - are your images in the right folder?
4L4K1 10-Dec-21 4:57am    
I create a folder in my project by name "0TestFancyBox" and images names also are correct. adding type not working too

1 solution

I installed version 2 but using other versions syntax
so I Installed vs4 and used its syntax and it works
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900