Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2010-09-30 20:48:03

helmz
Member
Registered: 2010-09-14
Posts: 65

Re: Fancybox and Textpattern

Have this and still not working:

<a>
<a class="fancy" <txp:image id="6" /> 
<txp:thumbnail id="6" /></a>
<script>
$('a.fancy').fancybox();
'transitionIn'    :    'elastic',
        'transitionOut'    :    'elastic',
        'speedIn'        :    600, 
        'speedOut'        :    200, 
        'overlayShow'    :    false

</script></a>

Now where can be the problem. I must say that is into a slideshow that when u do <a></a> it takes it like 1 image, so if i put 2 <a> its like 2 images… and take the text like it was an image

Last edited by helmz (2010-09-30 20:49:41)

Offline

#17 2010-09-30 22:05:31

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: Fancybox and Textpattern

Missing brackets around your fancybox settings.

 $('a.fancy').fancybox({
        'transitionIn'    :    'elastic',
        'transitionOut'    :    'elastic',
        'speedIn'        :    600, 
        'speedOut'        :    200, 
        'overlayShow'    :    false
});

More examples on Fancybox site.

Last edited by MattD (2010-09-30 22:06:50)


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#18 2010-09-30 22:29:41

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Fancybox and Textpattern

helmz wrote:

Have this and still not working:

You didn’t fix the issues Jeff pointed out and you ended up adding more issues.

  1. Now you have two links tangled together.
  2. The link (a elements) opening tag still doesn’t have closing tag.
  3. Scripts’ mandatory type attribute is missing.
  4. The additions you made to JavaScript don’t do anything atm. You should be feeding them to the function, now they just cause parsing errors.
  5. You are not link to anything, nor telling fancybox to what content to show in the box. TXP’s image tag doesn’t output URLs, if that is what you are trying. It outputs imgs.

Now, then. What are you trying to do? What output? What should the Fancybox show? Start by Reading Fancybox’s How-to, and take look at the examples and tips.

For example, this, what you tried:

$('a.fancy').fancybox();
'transitionIn'    :    'elastic',
        'transitionOut'    :    'elastic',
        'speedIn'        :    600, 
        'speedOut'        :    200, 
        'overlayShow'    :    false

Doesn’t do anything. If you want to feed options to Fancybox, you need to feed them, not just place the lines somewhere. As Matt said, for example:

$('a.fancy').fancybox(
    {
        'transitionIn' : 'elastic',
        'transitionOut' : 'elastic',
        'speedIn' :    600, 
        'speedOut' : 200, 
        'overlayShow' : false
    }
);

You also probably should initialize the code on page load and centralize the code in the page’s head segment or in external javascript file.

All-in-all, we get something like this:

<script type="text/javascript">
    $(document).ready(function(){
        $('a.fancy').fancybox(
            {
                'transitionIn' : 'elastic',
                'transitionOut' : 'elastic',
                'speedIn' : 600, 
                'speedOut' : 200, 
                'overlayShow' : false
            }
        );
    });
</script>
<a class="fancy" href="/some/content/to/link.png.etc">
    <txp:thumbnail id="6" />
</a>

Last edited by Gocom (2010-09-30 22:35:19)

Offline

#19 2010-10-01 08:11:26

helmz
Member
Registered: 2010-09-14
Posts: 65

Re: Fancybox and Textpattern

and what if I need the first image in the first href?

thanks :)

Offline

#20 2010-10-02 11:04:32

helmz
Member
Registered: 2010-09-14
Posts: 65

Re: Fancybox and Textpattern

anyone knows?

Offline

#21 2010-10-02 12:18:34

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Fancybox and Textpattern

You shouldn’t bump a thread without providing more information. I know this is difficult if English isn’t your first language, but to get help you’ve got to try harder.

Your code examples have all shown a single image, so it isn’t clear what you’re asking by “what if I need the first image in the first href?” Are you trying to set up a slideshow, i.e. a succession of images in the same Fancybox? Or do you want a set of images each of which triggers its own Fancybox? In either case it will have to be someone who knows more about Fancybox than I do who gives you the answer, but that’s the kind of information you need to provide.


Code is topiary

Offline

#22 2010-10-02 15:32:49

helmz
Member
Registered: 2010-09-14
Posts: 65

Re: Fancybox and Textpattern

Ok… I write it better:

I have this code

<a class="fancy" href="/some/content/to/link.png.etc">
    <txp:thumbnail id="6" />
</a>

Ok. Now I dont want to get this image

href="/some/content/to/link.png.etc"

I want this

<txp:image id="6" />

How can i do that? Thanks.

Last edited by helmz (2010-10-02 15:33:08)

Offline

#23 2010-10-02 15:44:03

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Fancybox and Textpattern

In the code you show you have hard-coded the image id, so you can do the same with the href:

<a class="fancy" href="/images/6.png">
    <txp:thumbnail id="6" />
</a>

This assumes you have kept the default name of images for your Txp image directory, and that your site root is also the domain root (i.e., not a subdirectory).

For a more generalized solution, where you don’t know the image id in advance, you would need either a plugin or the new image tags in Txp 4.3.0, which hasn’t been officially released yet.


Code is topiary

Offline

#24 2010-10-04 08:13:37

helmz
Member
Registered: 2010-09-14
Posts: 65

Re: Fancybox and Textpattern

That’s it, ty.

Offline

Board footer

Powered by FluxBB