Go Back   SitePoint Forums > Forum Index > Program Your Site > JavaScript
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
Reply
 
Thread Tools Display Modes
Old Nov 8, 2009, 15:14   #1
ryanhellyer
SitePoint Mentor
 
ryanhellyer's Avatar
 
Join Date: Oct 2006
Location: New Zealand
Posts: 2,297
jQuery "slide from bottom" and "inside tabber" problems

Hi,
I'm having two problems with the following page:
http://pixopoint.com/demo/javascript/grecco.html

(1) You are supposed to be able to click on the left and right buttons to scroll horizontally, but for some reason they don't work when used in side the tabber (the sub-menu uses the jQuery tabber system).

(2) When you click on the image, a lightbox appears, however I need a lightbox which slides in from the bottom, like the one here ... http://www.nakedambition.com/ (click "See the Movie" or "Get the Book").


Any ideas on where I'm going wrong with the scroller? And any tips on how to get a lightbox style effect where it slides in from the bottom?

All help much appreciated!
Thanks

PS: Please excuse the n00b'ish questions. JavaScript seems to be my brains worst enemy
ryanhellyer is offline   Reply With Quote
Old Nov 16, 2009, 09:47   #2
molona
Community Advisor
SitePoint Award Recipient
 
molona's Avatar
 
Join Date: Feb 2005
Location: from Madrid to Heaven
Posts: 3,305
I can't get to see the code in two of your javascript files... maybe they're not loading correctly and that's part of the problem (one of the is magic.js which I assume is the one that has the lightbox effect as it does in the other site)
molona is offline   Reply With Quote
Old Nov 16, 2009, 10:07   #3
JimmyP
Array Popper
 
JimmyP's Avatar
 
Join Date: Aug 2007
Location: Hampton, UK
Posts: 1,980
I haven't had a proper look through the code, as there is quite a lot of it, but from the looks of things your arrows are not having any event handlers bound to them, which means nothing is going to happen when they're clicked.

You're going to have to custom-build something if you want a lightbox appearing from the bottom - it's not too tricky though - since you're using jQuery...

It looks like you've got quite a lot going on in that page (JavaScript-wise). It's probably a good idea to just start again, adding each enhancement one at a time, and then confirming it works properly. This shouldn't take long, since you're just using plugins. Just remember that, while plugins may work well on their own, they're not guaranteed to play nice with each other.
JimmyP is offline   Reply With Quote
Old Nov 16, 2009, 16:03   #4
ryanhellyer
SitePoint Mentor
 
ryanhellyer's Avatar
 
Join Date: Oct 2006
Location: New Zealand
Posts: 2,297
Sorry, I should have removed that magic.js file. It was related to something different and isn't used on the page.

Here's a much more simplified version of the page. It's only loading
http://pixopoint.com/demo/javascript/grecco2.html
ryanhellyer is offline   Reply With Quote
Old Nov 16, 2009, 23:41   #5
Mal Curtis
Team SitePoint
 
Mal Curtis's Avatar
 
Join Date: Jul 2009
Location: Melbourne, Australia
Posts: 250
Try this - it will attempt to reattach the event handlers when the tabs are changed.

Place the code which applies the slider inside a function, then call that function in two scenarios

1) When the page loads - to get your initial slider
2) When you change tabs (callback) - to attach the event handlers to the sliders.

Wrap in a function
JavaScript Code:
function applyAnythingSlider(){ 
    $(function () {
 
    $('.anythingSlider').anythingSlider({
        easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
        autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
        delay: 7500,                    // How long between slide transitions in AutoPlay mode
        startStopped: false,            // If autoPlay is on, this can force it to start stopped
        animationTime: 1000,             // How long the slide transition takes
        hashTags: true,                 // Should links change the hashtag in the URL?
        buildNavigation: false,          // If true, builds and list of anchor links to link to each slide
        pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
        startText: "Go",             // Start text
        stopText: "Stop",               // Stop text
        navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
    });
    $("#slide-jump").click(function(){
        $('.anythingSlider').anythingSlider(6);
    });
});
}
// Then call the function
resetAnythingSlider();

And then call the resetAnythingSlider in the callbacks (this is your tabber.js).
JavaScript Code:
var $ = jQuery;
$(function() {
    $("#tabs").tabs({
         onShow: function() {
            resetAnythingSlider();
        }
    });
    //$('#tabs').tabs({ fxFade: true, fxSpeed: 'slow' });
    //$('#tabs').tabs({ fxSlide: true });
});
Mal Curtis is offline   Reply With Quote
Old Nov 17, 2009, 04:06   #6
molona
Community Advisor
SitePoint Award Recipient
 
molona's Avatar
 
Join Date: Feb 2005
Location: from Madrid to Heaven
Posts: 3,305
I think, Ryan, that they were faster than me. Sorry
molona is offline   Reply With Quote
Old Nov 17, 2009, 19:21   #7
markbrown4
padawan
 
markbrown4's Avatar
 
Join Date: Jul 2006
Location: Victoria, Australia
Posts: 3,029
The actual sliding from the bottom part isn't all too difficult.
Code:
<div id="lightbox" style="display:none"></div>

#lightbox {
  position: absolute;
  bottom: 0;
  left: 50%;
  margin-left: -250px
  width: 500px;
}

if ($('#lightbox').is(':hidden') {
  $('#lightbox').slideDown('slow');
}
else {
  $('#lightbox').slideUp('slow');
}
Hope it helps,
markbrown4 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Sponsored Links
 
Forum Jump


All times are GMT -7. The time now is 22:06.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved