SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Thread: ContentFlow

  1. #1
    SitePoint Member
    Join Date
    Apr 2008
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ContentFlow

    I am using ContentFlow from http://www.jacksasylum.eu/ContentFlow/

    It is very well documented on their website.

    I got the whole thing working great on my site.

    What I don't know is how to change the ActiveItem onclick to just bump it over to the next image as if the next image had been clicked.

    As of right now it opens the image source in a self window. I don't want that.

    Can anyone give me a clue or maybe the whole answer on how to get it to click over to the next image?

    I believe the answer lies in the contentflow_src.js file.

  2. #2
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could try modifying the script to something like the following:

    Change:
    Code:
    onclickActiveItem: function (item) {
                var url, target;
    
                if (url = item.content.getAttribute('href')) {
                    target = item.content.getAttribute('target');
                }
                else if (url = item.element.getAttribute('href')) {
                    target = item.element.getAttribute('target');
                }
                else if (url = item.content.getAttribute('src')) {
                    target = item.content.getAttribute('target');
                }
    
                if (url) {
                    if (target)
                        window.open(url, target).focus();
                    else
                        window.location.href = url;
                }
            },
    to something like the following:

    Code:
    onclickActiveItem: function (item) {
                this.moveToIndex('next');
            },
    You might need to add some logic for it to work on the last item of the collection.

  3. #3
    SitePoint Member
    Join Date
    Apr 2008
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, although I previously tried that and variations thereof and it did not work. I will give it another try since we both drew the same conclusion.

  4. #4
    SitePoint Member
    Join Date
    Apr 2008
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, it didn't work. I still clicks to the singular image on a blank page.

    I hope I figure it out soon.

    It seems like no matter what I do with the script, it always does the same thing.

    I wish they would get back to me, I contacted them about it before I even posted here.

  5. #5
    SitePoint Member
    Join Date
    Apr 2008
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    k! Figured it out! There were 2 javascript files being called. I did this in the header:

    <script language="JavaScript" type="text/javascript" src="ContentFlow/contentflow_src.js"></script>

    <!--<script language="JavaScript" type="text/javascript" src="ContentFlow/contentflow.js"></script>-->

    Now it goes to the next image on click just like I wanted!!

    Turns out it was calling the exact same script twice and the one being adjusted should be the only one being called. Otherwise any changes would simply be reverted back to the unedited script. It took a while for me to realize they where the same script because one was neatly formatted and the other was all jumbled together.

    The script change you gave me helped, too! Thanks a lot!

    I have tested it and it works fine. Since I have it already set for continuous loop it just goes to the first image automatically once you click on the last image. All is well! Thanks again!
    Last edited by nuwud; Jul 22, 2010 at 09:17. Reason: new update

  6. #6
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is because contentflow.js is the minimized version of the file (to reduce its size), so effectively you were calling the same script twice.

    Glad you solved your problem!

  7. #7
    SitePoint Member
    Join Date
    Apr 2008
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was wondering why it was all jumbled together... Does it save that much space in a file size to have it that way?
    Last edited by nuwud; Jul 22, 2010 at 20:01. Reason: typo


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •