asp .net dynamically loaded content won't work

118 views
Skip to first unread message

maarten bennis

unread,
May 14, 2013, 6:02:22 AM5/14/13
to fanc...@googlegroups.com
Hi I'm having trouble with dynamically loaded content.
 
I'm working on a .net project where I want to use fancybox.
In my code behind files I get images from the database and load these to the page.
the images show nicely, but fancybox does nothing.
 
 
If i make a direct link to the images in my html file fancybox does work.
 
the rendered html for the dynamically loaded images and the direct called images is identical:
<a class="fancybox" href="/files/__banner/Slider-2.jpg"><img alt="" src="/files/__banner/Slider-2.jpg"></a>
 
 
I load fancybox with:
<script type=\"text/javascript\" language=\"Javascript\">
$(document).ready(function
() {
$(".fancybox"
).fancybox();
});
</script>
 
What am i doing wrong, or what am i missing.
Hope somebody can help me.
 
 
Greetings,
Maarten

JFK

unread,
May 14, 2013, 11:20:39 PM5/14/13
to fanc...@googlegroups.com
If using fancybox v1.3.4 check http://stackoverflow.com/a/9084293/1055987

maarten bennis

unread,
May 15, 2013, 3:50:55 AM5/15/13
to fanc...@googlegroups.com
I'm am using version 2.1.4

maarten bennis

unread,
May 15, 2013, 4:19:08 AM5/15/13
to fanc...@googlegroups.com
Just tried with version 1.3.4, but it still doesn't work.
 

RavanH

unread,
May 15, 2013, 6:04:58 AM5/15/13
to fanc...@googlegroups.com
Those back slashes in the first line of your script code, are they rendered in the HTML output or is that snippet taken from your ASP source? In that case, why are there no back slashes used in the third line?

And did you check the resulting page source code for errors? Did you check your browsers script console for errors?

Op dinsdag 14 mei 2013 12:02:22 UTC+2 schreef maarten bennis het volgende:

maarten bennis

unread,
May 15, 2013, 9:21:51 AM5/15/13
to fanc...@googlegroups.com
I tried with:
 
$(document).ready(function () {
    $("#Footercarousel").on("focusin", function () {
        $("a.fancybox").fancybox({
            // fancybox API options here
            'padding': 0
        }); // fancybox
    }); // on
}); 
 
But also this won't work.
I can't see any errors.
 

JFK

unread,
May 15, 2013, 8:43:14 PM5/15/13
to fanc...@googlegroups.com
if using v2.1.4, it should work with dynamic content
got a link?

maarten bennis

unread,
May 16, 2013, 8:32:46 AM5/16/13
to fanc...@googlegroups.com
Thanks for taking the time.
 
 
You can see the website at http://temp.sprite-it.nl 
 
I'm using CarouFredSel for the images in the footer, I want to use FancyBox with these images.
 
I hope you can see what's wrong.
It's probably something small, but i can't see it.

JFK

unread,
May 16, 2013, 9:39:38 PM5/16/13
to fanc...@googlegroups.com
broken link

maarten bennis

unread,
May 17, 2013, 3:37:56 AM5/17/13
to fanc...@googlegroups.com
Sorry, it was a DNS issue. It should work now.
 
thanks again 

JFK

unread,
May 18, 2013, 7:05:52 PM5/18/13
to fanc...@googlegroups.com
It seems that the carrousel cloning process is somewhat affecting fancybox
why don't you try $("#FooterSliderImage a.fancybox").fancybox() instead of $(".fancybox").fancybox() only?

maarten bennis

unread,
May 21, 2013, 4:35:40 AM5/21/13
to fanc...@googlegroups.com
I turned off the carousel for the footer images.
and tried   $("#FooterSliderImage a.fancybox").fancybox(), but still no luck.
 
I also tried  $("#Footercarousel a.fancybox").fancybox()
and  $("a.fancybox").fancybox()
and  $(".fancybox").fancybox()
 
 

halcyon1234

unread,
May 22, 2013, 11:44:24 AM5/22/13
to fanc...@googlegroups.com
You have multiple divs with the ID "FooterSliderImage" on your page. I assume that's screwing something up.

Give them unique IDs.  If they're actually asp:Panels, make sure runat=server is on so they'll get unique ClientIDs.

In any case, you only want the div that wraps all your a.fancybox to be have ID of FooterSliderImage
Reply all
Reply to author
Forward
0 new messages