Solved

Jquery Content Flow

Posted on 2011-02-14
7
1,728 Views
Last Modified: 2012-05-11
Hi,

I've implemented the following component - http://www.jacksasylum.eu/ContentFlow/index.php - however I'm unable to figure out how to make the items closer together.

Can someone please advise me how the best way to do this would be?

Many thanks in advance.
0
Comment
Question by:Webbo_1980
  • 4
  • 3
7 Comments
 
LVL 3

Expert Comment

by:thecrew
ID: 34889167
I haven't played with it but just glancing at the coverflow.js file I would say a good place to start would be to mess with the math around lines 271 and maybe 1658

lines starting at 271:
    calcSize: function (x, f) {
        var h = this.maxHeight/(Math.abs(x)+1);
        var w = h;

        return {width: w, height: h};
    },

    calcPosition: function (x, f, size) {
        var X = x * size.width * 2;
        var Y = - this.flowCenter.y + size.height/2;  // bottom
        return {x: X, y: Y};

    },

Open in new window



lines starting at 1658:
  
             /* set position */
            Item.style.left = this.flowCenter.x + position.x - size.width/2 + "px";
            Item.style.top = this.flowCenter.y - position.y - size.height/2 + "px";

Open in new window


It appears to me that those are the lines that have something to do with the position of the images. Since the image positions and sizes change dynamically as the images scroll across there is not going to be a CSS margin or anything that you can set. It has to be calculated per image and per "frame", that's what the JavaScript does.

Let me know if that works!

0
 

Author Comment

by:Webbo_1980
ID: 34891349
Hi

Many thanks for this - I think I'm probably doing something wrong - as I'm unable to find this in the coverflow.js - can you provide any help?

Thanks,

Webbo
0
 
LVL 3

Expert Comment

by:thecrew
ID: 34892377
I'm sorry, I meant to say contentflow not coverflow... What are you using to look at the contentflow.js file (dream weaver, notepad, textedit etc. etc.)?

This is the file I was looking at: http://www.jacksasylum.eu/ContentFlow/contentflow.js

That's the file that the example on their website uses.
Maybe I'm misunderstanding the problem at hand.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:Webbo_1980
ID: 34892566
Hi

Thanks for this :-)

The javascript I've used has been downloaded from the following link - http://www.jacksasylum.eu/ContentFlow/download.php.

Any help would be great.

Thanks,

Webbo
0
 
LVL 3

Accepted Solution

by:
thecrew earned 500 total points
ID: 34892679
Okay, to make that code legible...

1. Copy that piled together mess of code
2. Go to http://jsbeautifier.org/
3. Paste it in the text area and click "Beautify"
4. Copy those results back into your .js file and save it

Now, on line 639 you'll see this:
        calcSize: function (D) {
            var B = D.relativePosition;
            var C = 1 / (Math.abs(B) + 1);
            var A = C;
            return {
                width: A,
                height: C
            }
        },
        calcCoordinates: function (C) {
            var B = C.relativePosition;
            var E = this.conf.visibleItems;
            var D = 1 - 1 / Math.exp(Math.abs(B) * 0.75);
            var A = C.side * E / (E + 1) * D;
            var F = 1;
            return {
                x: A,
                y: F
            }
        },

Open in new window



and line 1739 has this:  _positionItem: function (S, A) {...
and line 1781 has this:  _scaleImageSize: function (N, P, I) {...

Both of those look suspect. Again I haven't tried anything. The dynamically created CSS is positioning and sizing the images using position:absolute and top and left coordinates. Perhaps those are being calculated at lines 1739 etc. Back up the .js file then play with numbers and see what happens, it's a great way to learn too!
Let me know what you come up with!
0
 

Author Comment

by:Webbo_1980
ID: 34892873
thank you that worked perfectly!
0
 
LVL 3

Expert Comment

by:thecrew
ID: 34892956
Awesome! Well done!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now