infinite scroll and fancybox

41 views
Skip to first unread message

negr...@piccoletrasgressioni.com

unread,
Nov 2, 2017, 7:28:11 AM11/2/17
to FancyBox

Good morning,
 I have a problem with fancybox and infinite scroll. When my page load new contents, fancybox don't open it.
This is my code:

<%
sub funzione1()
for i=1 to 4
response.write "<a href=""img/test"& i &".jpg"" data-fancybox=""images 1"" class=""imglink""><img src=""img/test"& i &".jpg"" style=""width:40%;""></a>"
next
response.write "*************************************************************************************************************************************************************"
end sub
%>

<html>
<head>
<link rel="stylesheet" type="text/css" href="/fancybox-3.0/dist/jquery.fancybox.min.css">
</head>
<body>
<div id="contentsWrapper" >
<div class="content">
<% 
call funzione1()
%>
<a href="testscroll.asp" id="next">NEXT</a>
</div>
</div>
</body>
<script src="//code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="/js/jquery.clever-infinite-scroll.js"></script>
<script>
   $('#contentsWrapper').cleverInfiniteScroll({
    contentsWrapperSelector: '#contentsWrapper',
    contentSelector: '.content',
    nextSelector: '#next',
    loadImage: 'ajax-loader.gif'
  });
  </script>
<!-- FANCYBOX -->
  <script src="/fancybox-3.0/dist/jquery.fancybox.js"></script>
  <script>
      $('.imglink').fancybox({
      thumbs : {
        showOnStart : true
      }
    })
  </script>
</html>


This is a test page where I load always 4 photo. After the first called, fancybox don't open next photos.
The message error is:
jquery-2.1.4.min.js:2 Uncaught Error: Syntax error, unrecognized expression: [data-fancybox=images 1]
    at Function.ga.error (jquery-2.1.4.min.js:2)
    at ga.tokenize (jquery-2.1.4.min.js:2)
    at ga.select (jquery-2.1.4.min.js:2)
    at Function.ga [as find] (jquery-2.1.4.min.js:2)
    at n.fn.init.find (jquery-2.1.4.min.js:2)
    at new n.fn.init (jquery-2.1.4.min.js:2)
    at n (jquery-2.1.4.min.js:2)
    at HTMLAnchorElement._run (jquery.fancybox.js:2632)
    at HTMLDocument.dispatch (jquery-2.1.4.min.js:3)
    at HTMLDocument.r.handle (jquery-2.1.4.min.js:3)

Sorry for my bad english.

Thanks for the help

Matt
Reply all
Reply to author
Forward
0 new messages