[jQuery] Click on anchor, wait 1/2 second, then scroll to matched ID

2009-07-08 Thread Martin Berglund

Hi

I am trying to create a nice little effect with an unordered list with
anchors to a definition list with matching ID's on each . When a
link in the  is clicked, I want to delay the scroll for half a
second, and then scroll down to the right spot.

Here is what i have written so far:

JavaScript:
$('ul li a').click(function() {
$('li').removeClass('selected');
$(this).parent('li').addClass('selected');
$(this).animate({
opacity: '1'
}, 500, function() {
var jump = $(this).attr('href');
$('dl').localScroll({
target: jump,
queue: true,
duration: 1000,
hash: true
});
});
});


HTML:


Jump


Jump



Title
Some text


I know this can be made more compact and elegant, but I don't know how
to do it.
I appreciate any pointers and tips on how to improve my code.

-Martin Berglund


[jQuery] Stop unwanted animation in accordion

2009-01-31 Thread Martin Berglund

Hi

I have tried to make a tiny accordion where .mouseover
triggers .show/.hide, and it seems to work alright. The issue I am
trying to solve is to prevent the animation from running after the
cursor is moved through the whole accordion. I want to get rid of the
chain reaction, if that is an understandable way to explain it.

You can se it here: http://jsbin.com/ikobi

- Martin Berglund


[jQuery] Horizontal mouse scroll wheel

2008-01-17 Thread Martin Berglund

Hi everybody! (my first post in this group)

I was surfing around some typography related sites today, and I came
across a site that was designed horizontally. This site (not my site) made me wonder if
there is an easy way to assign the x-axis to the mouse scroll wheel?

The behavior may not be as intuitive as the vertical scroll, but it
would be cool if it is possible.

- Martin