?
Solved

Jquery Content Flow

Posted on 2011-02-14
7
Medium Priority
?
1,787 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
Suggested Courses

765 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