Метка

jquery

Всего: 96 записей

jquery: плавный переход к якорю

$(document).ready(function() {
	$('a[href^="#"]').click(function () { 
		elementClick = $(this).attr("href");
		destination = $(elementClick).offset().top;
		if($.browser.safari){
			$('body').animate( { scrollTop: destination }, 1100 );
		}else{
			$('html').animate( { scrollTop: destination }, 1100 );
		}
		return false;
	});
});

вместо a name нужно указывать a id
http://serblog.ru/plavnyj-perexod-k-yakoryu-ssylke

jquery: slideToggle — проверить состояние

Действия при сворачивании и разворачивании блока..

function ToggleHSL() {
	$('#hsl').slideToggle('normal',function(){
		if ($(this).is(':hidden')) {
			$('#top').css('margin-top','0px');
		} else {
			$('#top').css('margin-top','-216px');
		}
		return false;
	});
}

http://www.sitepoint.com/forums/showthread.php?572201-jquery-finding-the-state-of-slideToggle