I would like to do the same effect with the one below (may be with animate);
HTML:
<html>
<body>
<section id="solutions" data-direction="from-left">
<div class="container">
<a href="#" class="close"></a>
<div class="row solutionsRow">
<div class="col-md-3 no-pad1">
<div id="right1" class="pics">
<img class="img-center" src="http://s33.postimg.org/k9sxc4hu7/smart_env.jpg" width="168" height="168" alt="Akıllı Çevre" />
<ul class="solutions-ul">
<li lang="tr">
<i class="fa fa-caret-right"></i> Hava Kirliliği
</li>
<li lang="tr">
<i class="fa fa-caret-right"></i> Orman Yangın Algılama
</li>
<li lang="tr">
<i class="fa fa-caret-right"></i> Deprem Erken Teşhis
</li>
<li lang="tr">
<i class="fa fa-file-image-o"></i> <a class="fancybox1" rel="gallery0" href="http://s33.postimg.org/yiy2aojm7/smart_world.jpg">Ek</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</section>
</body>
</html>
Javascript:
$(document).ready(function() {
$("#right1").cycle({
fx: 'scrollRight',
next: '#right1',
timeout: -3000,
easing: 'easeInOutBack'
});
$(".fancybox1").fancybox({
autoSize: true,
fitToView: true,
});
});
The reason is because I can NOT open fancybox when I click on the anchor inside of the UL while using cycle plugin. I do want to open fancybox and zoom.
Thanks in advance.
LAST AND FINAL EDIT
- Another satisfied client! lol!
For future SO readers:
The final solution is in this CodePen.
In short, this solution allows to use both
cycle.jsandFancyBox.jsplugins "interacting" or "mixed together"... And the use of the FancyBox's "gallery" feature... And... and... and... The possibility to insert link to PDF (or anything!)( Is there a term for plugin mix debugging? )
So you can read-on from the first answer and it's subsequential edits below:
(To fully understand how the solution works)
First answer:
I modified a couple things to you CodePen in order to make FancyBox usable with Cycle... Intead of trying to recreate the cycle effect with jQuery.
See this CodePen.
Explanations:
#right1div used with Cycle.js.clickhandler on the "Ek" link.It does these things:
Show the hidden image,
Simulate a
clickevent on the link wrapping the image to trigger FancyBox.HTML:
CSS:
Script:
EDIT
(After accepted answer and awarded bounty)
You asked a good question (in comments below)...
It deserves an edit.
To use my solution with many cycle.js instances, many links and use the FancyBox.js "gallery" feature
Its almost the same...
But from the clicked link, we have to determine:
About the "associated with" class:
I used a custom attribute on the div used with
cycle:<div id="right" class="pics" data-fancyBox_class="fancybox0">This is supported by HTML5, reference here.
I had to create a "delayed" function to add click handlers to the dynamically created FancyBox prev/next icons in order to make the prev/next image displayed.
And, finally, I made a quick fix on the "click conflict".
(On link click,
cycletriggers too...)Most changes are in this script, see this updated CodePen.
EDIT
(Added PDF link feature)
Added script:
How to define the link:
See updated CodePen
BUG NOTE: Strangely, the
window.open()function bugs in CodePen / Chrome 51... The new tab opens, but the document doesn't show. FireFox does behave correctly.I tryed it as a local html file and Chrome doesn't bug. Also tryed it under FF47, IE11, Opera ==> All working good.
Safari 5.1.7 (for Windows) ==> Opens another window instead of another tab. And when you close this new window, Safari crashes. I just can't figure out why.
I just updated to Chrome 52... Problem remains within CodePen...