Add custom html in outside the fancybox - javascript

$.fancybox({
content: '<button>prev</button><button>next</button>',
href: src,
'autoScale': false,
'transitoinIn': 'none',
'transitionOut': 'none',
.......
});
I simply open images in fancybox. I want to add some html button in fancybox but problem is that it is override the image. but I don't want to override the image so I want to add button outside the image.
Any help?

How about you try having z-index?
<style>
.btn1 {z-index: 5;}
</style>
<html>
...
<html>
<script>
$.fancybox({
content: '<button class="btn1">prev</button><button class="btn1">next</button>',
href: src,
'autoScale': false,
'transitoinIn': 'none',
'transitionOut': 'none',
.......
});
Or you can try having your buttons in the html and position it to absolute.

Related

jQuery Fancybox trigger not working properly

I am opening fancybox automatic when page load and for this, I am using trigger method with a hidden link inside the page, The problem is fancybox popup loading but its missing overlay, just that overlay is not opening.
I am using fancyBox v2.1.5
This is the code I am using
$(".login_signup_lb").fancybox({
maxWidth: 450,
autoSize: true,
fitToView: true,
openEffect: 'none',
closeEffect: 'none',
closeBtn: false,
helpers: {
overlay: {
css: {
'background': 'rgba(0, 0, 0, 0.6)'
}
}
}
}).trigger("click");
This is the html code which is hidden in the page
<a id="login_signup" class="login_signup_lb fancybox.ajax" href="fileurl.html" style="display:none;">
Lightbox
</a>
Try to trigger after creating fancybox
$(".fancybox.ajax").eq(0).trigger('click');
Here is jsfiddle

Jquery slider to load images when ready with placeholder

OK so I have a Jquery plugin that works great and all except it puts all of the images on top of each other until the plugin has finished loading, and then they all go into place. Is there a way to have the first image be a placeholder for the size 843 w 345 h and have it load hidden until they are all ready so my page site doesn't expand down then back up when it has loaded. thanks!
$(window).load(function(){
$('#slide-me').carousel({
style: 'fade',
transitionSpeed: 'slow',
carouselSpeed: 3500,
arrows: true,
buttons: false,
buttonsTheme: 'lines',
stopOnHover: false,
carouselHeight: 'crop',
carouselWidth: 'crop'
});
});
html
<div id="slide-me">
<img src="/tour/images/bigslider1.jpg" />
<img src="/tour/images/bigslider2.jpg" />
<img src="/tour/images/bligslider3.jpg" />
<img src="/tour/images/bligslider4.jpg" />
<img src="/tour/images/bigslider5.jpg" />
</div>
Give it a try, worked for me:
$(function(){
setTimeout(function(){
$('#slide-me').carousel({
style: 'fade',
transitionSpeed: 'slow',
carouselSpeed: 3500,
arrows: true,
buttons: false,
buttonsTheme: 'lines',
stopOnHover: false,
carouselHeight: 'crop',
carouselWidth: 'crop'
});
},500);
});
I actually got the answer for this and wanted to share in case anyone wanted to see it.
In my css all that was needed to do was this
#slide-me img { display: none; }
#slide-me img:first-child { display: block; }
Which allowed the first image to be shown first and hide the rest while script loaded.

How to popup url in lightbox

I am trying to popup the url using the lightbox, when i click the button, the lightbox call has been made, but the given url is not pop-up in the light box.
when i click the button it is showing popup with just small white screen
here is code i have used
code:
<a class="example-image-link" href="uitab/index.html" data-lightbox="example-1"><input class="buton" type="button" value="View details" name="View details"></a> </td>
how can i solve this?
try to use something like that may be it helps
<a class="various fancybox.ajax" href="uitab/index.html">Ajax</a>
$(document).ready(function() {
$(".various").fancybox({
maxWidth : 800,
maxHeight : 600,
fitToView : false,
width : '70%',
height : '70%',
autoSize : false,
closeClick : false,
openEffect : 'none',
closeEffect : 'none'
});
});
and read the example url here
http://fancyapps.com/fancybox/

JQuery Bubble Popup: innerhtml hidden div

I'm using the JQuery Bubble Popup library, trying to show a hidden div in the innerHtml variable. Right now I have this:
<div class="button"> Show stuff </div>
<div class="information"> foo </div>
<div class="button"> Show stuff </div>
<div class="information"> bar </div>
<script>
$(document).ready(function(){
$('.information').hide();
$('.button').CreateBubblePopup({
position: 'bottom',
align: 'center',
width: '300',
innerHtml: $(this).next(".information").html(),
innerHtmlStyle: { color:'#000', 'text-align':'left', 'font-size':'110%' },
themeName: 'grey',
themePath: '/static/images/jquerybubblepopup-theme',
selectable: true,
});
});
</script>
The thing is, it isn't working as I expected, the problem is in the line
innerHtml: $(this).next(".information").html(),
Because if I put this it works:
innerHtml: 'testing jquery bubblepopup',
The problem with this line:
innerHtml: $(this).next(".information").html(),
is that this is not referring to what you think it refers to. I think you want it to refer to the current button being affected, but it doesn't - it's the this value that's in effect in the "ready" handler context.
What you can do (among several things) is use the ".each()" function:
$('.button').each(function() {
$(this).CreateBubblePopup({
position: 'bottom',
align: 'center',
width: '300',
innerHtml: $(this).next(".information").html(),
innerHtmlStyle: { color:'#000', 'text-align':'left', 'font-size':'110%' },
themeName: 'grey',
themePath: '/static/images/jquerybubblepopup-theme',
selectable: true
});
});
Also you've got a stray comma at the end of the bubble popup parameter object, which will get you an error from IE.

How can I use fancybox using onclick?

I am trying to make use of JQuery and Fancybox. This is how it should be used: http://fancy.klade.lv/howto
However, I can not generate many ids for "a href" and I do not want to make many instances of fancybox ready. So I want to be able to use one fancy box instance for many hyperlinks that do the same thing.
Whenever any of these links are clicked, the fancybox should popup for it. I thought I would use the onclick attribute for a "<a href" tag or any other tags, I can chnage this but how do I use the fancybox? I tried this but nothing came up:
Not Working?
Thanks for any help
Don't do it that way. If you can't generate unique IDs (or simply don't want to) you should be doing it with CSS classes instead:
<img src="image_thumbnail.jpg">
with:
$(function() {
$("a.fancy").fancybox({
'zoomSpeedIn': 300,
'zoomSpeedOut': 300,
'overlayShow': false
});
});
(from their usage page).
This demonstrates how to use fancybox (1.3.4) without requiring the <a href> link element by calling fancybox directly.
Inline:
<div id="menuitem" class="menuitems"></div>
<div style="display:none;">
<div id="dialogContent">
</div>
</div>
$('.menuitems').click(function() {
$.fancybox({
type: 'inline',
content: '#dialogContent'
});
});
Iframe:
<div id="menuitem" class="menuitems"></div>
$('.menuitems').click(function () {
$.fancybox({
type: 'iframe',
href: 'http://www.abc123.com'
});
});
HTML:
<a href="http://domain.com/bigimage.jpg" onclick="return fancybox(this);><img scr="http://domain.com/smallimage.jpg" /></a>
JSCode:
function fancybox(elem) {
elem = $(elem);
if (!elem.data("fancybox")) {
elem.data("fancybox", true);
elem.fancybox({
'overlayColor' : '#000',
'overlayOpacity' : 0.5
});
elem.fancybox().trigger('click');
}
return false;
}
IN CASE, you want to open contents of multiple divs within the page. i.e. part of the same page in fancybox, you can do it by following code:
open_fancy1
open_fancy2
<div style="display:none">
<div id="show-in-fancy1">
this content is shown in fancybox.
</div>
<div id="show-in-fancy2">
this content is shown in fancybox.
</div>
</div>
<script>
$(document).ready(function(){
$('.popup').fancybox({
'zoomSpeedIn': 300,
'zoomSpeedOut': 300,
'overlayShow': false
});
});
</script>
NOTE: Make sure that you have included fancybox.js
Ronald answer gave me string #dialogContent content in fancyBox v2.1.5. Try to use:
<div id="item"></div>
<div style="display:none"><div id="data">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div></div>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#item").fancybox({
type: 'inline',
content: jQuery('#data').html()
});
});
</script>
$(".btn_fancybox_messagerie").on("click", function(event) {
//event.preventDefault();
var to = $(this).text();
$.fancybox.open({
type: 'iframe',
src: 'http://..../form-messagerie.php?to=' + to,
toolbar : false,
smallBtn : true,
iframe : {
preload : false,
scrolling: 'auto'
}
});
});
In fancybox 3 it can be done by using following code.
jQuery().fancybox({
selector : 'your selector'
});

Categories