I want to apply an image filtration technique and also want to make the image opens in a fancy box, I added the code and made links to the scripts that I need but while adding the below script link :
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
above the filtering links and script, the filter works but the fancy box doesn't want to work and while adding the same link above fancy box links and script, the fancy box works but the filter doesn't want to work...
Here is some of my code:
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<!-- Add jQuery library of fancybox -->
<script type="text/javascript" src="image-library/lib/jquery-1.10.1.min.js"></script>
<!-- Add mousewheel plugin (this is optional) -->
<script type="text/javascript" src="image-library/lib/jquery.mousewheel-3.0.6.pack.js"></script>
<!-- Add fancyBox main JS and CSS files -->
<script type="text/javascript" src="image-library/source/jquery.fancybox.js?v=2.1.5"></script>
<link rel="stylesheet" type="text/css" href="image-library/source/jquery.fancybox.css?v=2.1.5" media="screen" />
<!-- Add Button helper (this is optional) -->
<link rel="stylesheet" type="text/css" href="image-library/source/helpers/jquery.fancybox-buttons.css?v=1.0.5" />
<script type="text/javascript" src="image-library/source/helpers/jquery.fancybox-buttons.js?v=1.0.5"></script>
<!-- Add Thumbnail helper (this is optional) -->
<link rel="stylesheet" type="text/css" href="image-library/source/helpers/jquery.fancybox-thumbs.css?v=1.0.7" />
<script type="text/javascript" src="image-library/source/helpers/jquery.fancybox-thumbs.js?v=1.0.7"></script>
<!-- Add Media helper (this is optional) -->
<script type="text/javascript" src="image-library/source/helpers/jquery.fancybox-media.js?v=1.0.6"></script>
<script type="text/javascript">
$(document).ready(function() {
/*
* Simple image gallery. Uses default settings
*/
$('.fancybox').fancybox();
/*
* Different effects
*/
// Change title type, overlay closing speed
$(".fancybox-effects-a").fancybox({
helpers: {
title : {
type : 'outside'
},
overlay : {
speedOut : 0
}
}
});
// Disable opening and closing animations, change title type
$(".fancybox-effects-b").fancybox({
openEffect : 'none',
closeEffect : 'none',
helpers : {
title : {
type : 'over'
}
}
});
// Set custom style, close if clicked, change title type and overlay color
$(".fancybox-effects-c").fancybox({
wrapCSS : 'fancybox-custom',
closeClick : true,
openEffect : 'none',
helpers : {
title : {
type : 'inside'
},
overlay : {
css : {
'background' : 'rgba(238,238,238,0.85)'
}
}
}
});
// Remove padding, set opening and closing animations, close if clicked and disable overlay
$(".fancybox-effects-d").fancybox({
padding: 0,
openEffect : 'elastic',
openSpeed : 150,
closeEffect : 'elastic',
closeSpeed : 150,
closeClick : true,
helpers : {
overlay : null
}
});
/*
* Button helper. Disable animations, hide close button, change title type and content
*/
$('.fancybox-buttons').fancybox({
openEffect : 'none',
closeEffect : 'none',
prevEffect : 'none',
nextEffect : 'none',
closeBtn : false,
helpers : {
title : {
type : 'inside'
},
buttons : {}
},
afterLoad : function() {
this.title = '';
}
});
/*
* Thumbnail helper. Disable animations, hide close button, arrows and slide to next gallery item if clicked
*/
$('.fancybox-thumbs').fancybox({
prevEffect : 'none',
nextEffect : 'none',
closeBtn : false,
arrows : false,
nextClick : true,
helpers : {
thumbs : {
width : 50,
height : 50
}
}
});
/*
* Media helper. Group items, disable animations, hide arrows, enable media and button helpers.
*/
$('.fancybox-media')
.attr('rel', 'media-gallery')
.fancybox({
openEffect : 'none',
closeEffect : 'none',
prevEffect : 'none',
nextEffect : 'none',
arrows : false,
helpers : {
media : {},
buttons : {}
}
});
/*
* Open manually
*/
$("#fancybox-manual-a").click(function() {
$.fancybox.open('1_b.jpg');
});
$("#fancybox-manual-b").click(function() {
$.fancybox.open({
href : 'iframe.html',
type : 'iframe',
padding : 5
});
});
$("#fancybox-manual-c").click(function() {
$.fancybox.open([
{
href : '1_b.jpg',
title : 'My title'
}, {
href : '2_b.jpg',
title : '2nd title'
}, {
href : '3_b.jpg'
}
], {
helpers : {
thumbs : {
width: 75,
height: 50
}
}
});
});
});
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<link rel="stylesheet" href="filter/filtrify.css">
<script src="filter/highlight.pack.js"></script>
<script src="filter/script.js"></script>
<script src="filter/filtrify.min.js"></script>
<script type="text/javascript">
$(function() {
var ft = $.filtrify("cbp-rfgrid", "placeHolder");
$("a#1").click(function() {
ft.trigger({ categories : ["Photography"] });
});
$("a#2").click(function() {
ft.trigger({ categories : ["Retouching"] });
});
$("a#3").click(function() {
ft.trigger({ categories : ["CGI"] });
});
$("a#4").click(function() {
ft.trigger({ categories : ["Oranges"] });
});
$("div#triggers > a").click(function() {
$(this)
.addClass("selected")
.siblings("a")
.removeClass("selected");
});
$("a#reset strong").click(function() {
ft.reset();
$(this).addClass("selected");
$('#triggers .selected').removeClass("selected");
});
$("li").click(function() {
ft.reset();
$(this).addClass("selected");
$('#triggers .selected').removeClass("selected");
});
});
</script>
</head>
Also you can refer to the below link to see it alive with the fancy box problem...
http://arqqa.net/aostudio-beta/
In your live example, first you are calling upon jQuery (1.10.1), then you are embedding the Fancybox scripts, followed by the script to execute fancybox.
After your actions section you are calling upon another jQuery (1.8.2). Having multiple instances of jQuery is likely to give you the conflict.
Use jQuery only once, and make it the first script to be executed.
Make sure your actions are the last script to be executed.
Place your actions in an external javascript file.
Place javascript before the closing body tag in your document.
you can use two versions of jquery at the same time:
https://api.jquery.com/jQuery.noConflict/
Unfortunately I can confirm that this won't work with later versions of jQuery (1.0.7). I downloaded the demo found at
http://tutorialzine.com/2011/02/converting-jquery-code-plugin/
and replaced the jQuery lib reference to a later version and the ddl fails to function.
NB - I'm also aware that I'm not providing an answer here, but in the infinite wisdom of the site administrators I'm not allows to comment without having reached the required number of brownie points!
Related
I use fancybox into a html page but i can't style the link to open the fancybox. Normaly i use a class to style the html link but with fancybox the class is already given to the fancybox. I need to change the background color of the link liks this:
background-color: #E9F3D8;
Here is the fancybox script i use into the html page
<script type="text/javascript">
$(document).ready(function() {
$(".contactForm").fancybox({
'width' : 750,
'height' : 420,
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe'
});
});
</script>
And the link into this page looks linke this
mail
Hard to recreate problem with jsfiddle because all work fine here
<style>
a {
background-color: #E9F3D8;
}
</style>
<script>
$(document).ready(function() {
$(".contactForm").fancybox({
'width' : 750,
'height' : 420,
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe'
});
});
</script>
Maybe give more details that we can help you or maybe I do something wrong with recreating.
My goal was to play a mov-file that's already uploaded on my server and it'd be nice to have it pop up inframe using fancybox and jquery. However I have attempted with no luck substituting .mov to swf-type in these codes:
<a class="various" href="Poem.MOV">Play movie</a>
with this Jquery from the fancybox website's suggestion-list:
<script src="jquery.js"></script>
<script type="text/javascript" src="jquery.fancybox.js"></script>
<script>
$(document).ready(function() {
$(".various").fancybox({
maxWidth : 800,
maxHeight : 600,
fitToView : false,
width : '70%',
height : '70%',
autoSize : false,
closeClick : false,
openEffect : 'none',
closeEffect : 'none'
});
});
</script>
This only sent me to a different webpage playing that mov-file. A different and closest code that ever worked by popping the video up in a fancybox inframe successfully BUT does not play or even show up at all. It only showed up in white frame without playing the film:
HTML:
<a class="fancybox" data-type="swf" href="Poem.MOV" title="Poem">Play Movie</a>
JAVASCRIPT:
<script>
jQuery(document).ready(function($){
$(".fancybox").on("click", function(){
$.fancybox({
href: this.href,
type: $(this).data("type")
}); // fancybox
return false
}); // on
}); // ready
</script>
I wonder if this is feasible to play .mov on our own server using fancybox without using third-party server such as YouTube or Vimeo. Thanks for your time.
You can use the JWplayer player with fancybox to play the .mov or other video formats.
below is the code to integrate jWplayer with fancybox:
$(".various").fancybox({
fitToView: true,
content: '<div id="myJWPlayer">Loading the player ...</div>',
scrolling: 'no',
afterShow: function () {
var video_href= j(this.element).data('url');
$('#myJWPlayer').css({height:'400px',width:'500px'});
setTimeout(function(){
jwplayer('myJWPlayer').setup({
'file' : video_href,
"autostart" : "true",
"controlbar" : "bottom",
"flashplayer" : "url-to-/jwplayer.flash.swf",
"volume" : "70",
"width" : 500,
"height" : 400,
"mute" : "false",
"stretching" : "fill"
});
updateViewTime(vid);
},100);
}
});
I had a problem where the HTML5 video player worked, but loading the same .mov into fancybox did not play. My solution was to either add the url of the video directly to the video tag, or to set the "type" attribute of the source tags as empty in the afterLoad() callback.
const attachment_movie = [ 'mp4', 'mov' ];
$.fancybox.open(gallery, {
buttons: [
'download',
'zoom',
'slideShow',
'thumbs',
'close'
],
thumbs: { 'autoStart': true },
afterLoad : function() {
var href = this.src;
var ext = href.substr(href.lastIndexOf('.') + 1).toLowerCase();
if ( $.inArray(ext, attachment_movie) > -1 )
$('.fancybox-video').prop('src', href);
// or
if ( $.inArray(ext, attachment_movie) > -1 )
$('.fancybox-video source').prop('type', '');
}
});
I managed to workaround the problem by replacing template for <video> tag. I added src="{{src}}" to the video tag. You can also pass that as a part of options.
$.fancybox.defaults.video = {
...$.fancybox.defaults.video,
tpl: `
<video class="fancybox-video" poster="{{poster}}" src="{{src}}">
<source src="{{src}}" type="{{format}}" />Sorry, your browser doesn't support embedded videos,
download and watch with your favorite video player!
</video>`
};
On this link the FancyBox shows the video but with black bars to the side. Also when I resize the browser black bars appear on the top. I tried everything I could find on SO and elsewhere but I can't seem to find the solution.
This is my JS setup of the FancyBox:
<script type="text/javascript">
$(document).ready(function() {
$('.fancybox').fancybox({
openEffect : 'none',
closeEffect : 'none',
helpers : {
media : {}
},
autoSize: false,
fitToView: true,
maxWidth: 960,
maxHeigth: 540,
height: '70%',
width: '70%',
});
});
</script>
Where do I need to look to fix this?
I found if you update the width of div which class is flideo , that would fix this problem
you coulde see the picture url below
https://dl.dropboxusercontent.com/u/23971112/stackoverflow/fancybox%20black%20bar.JPG
Im trying to use Fancybox to build an before/after gallery. Thats how it works:
1) The page load with a lot of thumbnails
2) When the thumb is clicked, it loads the fancybox gallery
3) When the user hover the image, it changes to the "before" state
I already did the steps 1 and 2. How can I make the 3ยบ?
Solved:
$(".fancybox").fancybox({
padding:0,
margin:60,
nextClick:true,
openEffect : 'none',
closeEffect : 'none',
nextEffect:'fade',
prevEffect:'fade',
nextSpeed :1,
prevSpeed:1,
afterShow : function() {
$('.fancybox-nav').hide();
$(".fancybox-image").hover(
function() {$('.fancybox-next span').click();},
function() {$('.fancybox-next span').click();}
);
}
})
I'm getting a bug with Internet Explorer. The iframe doesn't have correct size and it is displayed on the top left of the page instead of the center.
In Firefox and Chrome, everything is working perfectly.
Tried many things but I couldn't find a solution :(
Please help me.
You can see the bug in IE8 here:
http://www.ni-dieu-ni-maitre.com/v2/index_v2.php
Click link labelled "iframe" on top left
Here's a screenshot of what it looks like:
Here's my code:
<head>
<script type=\"text/javascript\" src=\"http://www.$domain/scripts/jquery-1.8.2.min.js\"></script>
<script type=\"text/javascript\" src=\"http://www.$domain/scripts/jquery.fancybox.js?v=2.1.1\"></script>
<link rel=\"stylesheet\" type=\"text/css\" href=\"http://www.$domain/scripts/jquery.fancybox.css?v=2.1.1\" media=\"screen\" />
<script type=\"text/javascript\">
$(document).ready(function() {
$('.fancybox').fancybox();
$('.fancybox').click(function() {
$.fancybox.open({
href : 'iframe.html',
type : 'iframe',
padding : 5,
autoScale : false
});
});
$(\".contactbox\").fancybox({
openEffect : 'elastic',
openSpeed : 150,
closeEffect : 'elastic',
closeSpeed : 150,
closeClick : true,
'overlayShow' : false,
href : 'contact.php',
type : 'iframe',
padding : 5,
autoScale : true,
scrolling : 'no'
frameWidth : 430,
frameHeight : 380
});
});
</script>
</head>
<body background=\"$background\" id=\"top\">
<a class=\"contactbox\" href=\"http://$domain/contact.php\">Iframe</a>
Your page is rendered in quirks mode because you don't have a correct HTML DTD declaration.
If you bring up IE dev toolbar (F12), you can see it renders correctly in standards modes.