Facybox gets called at all anchor tags in page.

227 views
Skip to first unread message

Swapnil

unread,
May 20, 2009, 8:21:59 AM5/20/09
to fancybox
Hello All

I have added the fancybox on my webpage I am using Master Page in my
project.
I have added the following script on my master page.

$(document).ready(function() {
if ($("#biztalk1.ClientID") != null) {
$("#biztalk1").fancybox({ 'zoomSpeedIn': 300,
'zoomSpeedOut': 300, 'hideOnContentClick': false
});
$("#azure1").fancybox({ 'zoomSpeedIn': 300,
'zoomSpeedOut': 300, 'hideOnContentClick': false
});
$("#dotnet1").fancybox({ 'zoomSpeedIn': 300,
'zoomSpeedOut': 300, 'hideOnContentClick': false
});
$("#bpo1").fancybox({ 'zoomSpeedIn': 300,
'zoomSpeedOut': 300, 'hideOnContentClick': false
});
$("#sqlserver1").fancybox({ 'zoomSpeedIn': 300,
'zoomSpeedOut': 300, 'hideOnContentClick': false
});
}
});
and my images on which they get called are in other page.
It works fine But I came to know it gets called on each and every
anchor tags of my page
and results the Object expected error in my application
Please any one knowing the cause can help me out

Thanks In adavance

JFK

unread,
May 21, 2009, 3:47:29 AM5/21/09
to fancybox
I see nothing wrong with your script; you may have a typo in your html

Andrew

unread,
Jun 1, 2009, 1:53:50 PM6/1/09
to fancybox
I am no expert at javascript (still learning), but I think I had a
similar issue when I first tried to move fancy box to one of my pages.
When you download the package, the html sample page has some embedded
script. It reads like this under the linked js files: (the line with
the arrows I think might be your culprit).

<script type="text/javascript">
$(document).ready(function() {
---------------> $("a").fancybox(); <----------
$("a.embed").fancybox({
'hideOnContentClick': false
});

});
</script>

since I am still learning, the best I can tell is that it applies
fancy box to all "a" elements, which is why it opens for every link on
your page. If you remove that line, like I did, it should work fine.
At least it worked for me. Again, I am no expert. let me know if it
works out.

Andrew

On May 20, 8:21 am, Swapnil <swapnilrsalu...@gmail.com> wrote:
> Hello All
>
> I have added the fancybox on my webpage I am using MasterPagein my

JFK

unread,
Jun 6, 2009, 5:20:38 PM6/6/09
to fancybox
@Andrew
That's very smart of you.
Honestly, I never ever checked the sample page before and I was still
wondering why so many people have had the same problem.
Now I realize they were copy and paste from the sample page for their
scripts.

The sample page is valid within the specific context it was created.
New users should not copy the script from the sample page but learn
from it and adapt it to their specific needs, mostly in divers and
complex environments.

Thanks for your contribution

Iván Martínez

unread,
Feb 29, 2012, 4:33:00 PM2/29/12
to fanc...@googlegroups.com
Hi, excuse me, can you please tell me where are these line located??


<script type="text/javascript"> 
                $(document).ready(function() { 
--------------->       $("a").fancybox();      <---------- 
                        $("a.embed").fancybox({ 
                'hideOnContentClick': false 
        }); 

                }); 
        </script> 

I cant find that line. Thank you.

JFK

unread,
Feb 29, 2012, 10:09:45 PM2/29/12
to fanc...@googlegroups.com
they don't exist unless you create them
you would need to create you own customized script .... the line you refer to is just an example
Reply all
Reply to author
Forward
0 new messages