[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Jquery Content Flow

Posted on 2011-02-14
7
Medium Priority
?
1,811 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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!
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…
Suggested Courses

649 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