document.onmousewheel=document.onwheel=function(){
return false;
};
document.addEventListener("MozMousePixelScroll",function(){return false},false);
document.onkeydown=function(e) {
if (e.keyCode>=33&&e.keyCode<=40) return false;
}
разрешить прокрутку страницы (обратное действие):
document.onmousewheel=document.onwheel=function(){
return true;
};
document.addEventListener("MozMousePixelScroll",function(){return true},true);
document.onkeydown=function(e) {
if (e.keyCode>=33&&e.keyCode<=40) return true;
}
Минимальная ширина для вложенных элементов списка равная ширине родительского элемента, т.е. минимальная ширина ul li ul li равна ширине ul li
$(document).ready(function(){
$('#top-menu ul li ul li').each(function() {
$(this).css('min-width',$(this).parent().parent().width());
});
});
Share = {
vkontakte: function(purl, ptitle, pimg, text) {
url = 'http://vkontakte.ru/share.php?';
url += 'url=' + encodeURIComponent(purl);
url += '&title=' + encodeURIComponent(ptitle);
url += '&description=' + encodeURIComponent(text);
url += '&image=' + encodeURIComponent(pimg);
url += '&noparse=true';
Share.popup(url);
},
odnoklassniki: function(purl, text) {
url = 'http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1';
url += '&st.comments=' + encodeURIComponent(text);
url += '&st._surl=' + encodeURIComponent(purl);
Share.popup(url);
},
facebook: function(purl, ptitle, pimg, text) {
url = 'http://www.facebook.com/sharer.php?s=100';
url += '&p[title]=' + encodeURIComponent(ptitle);
url += '&p[summary]=' + encodeURIComponent(text);
url += '&p[url]=' + encodeURIComponent(purl);
url += '&p[images][0]=' + encodeURIComponent(pimg);
Share.popup(url);
},
twitter: function(purl, ptitle) {
url = 'http://twitter.com/share?';
url += 'text=' + encodeURIComponent(ptitle);
url += '&url=' + encodeURIComponent(purl);
url += '&counturl=' + encodeURIComponent(purl);
Share.popup(url);
},
mailru: function(purl, ptitle, pimg, text) {
url = 'http://connect.mail.ru/share?';
url += 'url=' + encodeURIComponent(purl);
url += '&title=' + encodeURIComponent(ptitle);
url += '&description=' + encodeURIComponent(text);
url += '&imageurl=' + encodeURIComponent(pimg);
Share.popup(url)
},
popup: function(url) {
window.open(url,'','toolbar=0,status=0,width=626,height=436');
}
};
<a onclick="Share.vkontakte('URL','TITLE','IMG_PATH','DESC')"><img src="/images/share/vkontakte.png" alt=""/></a>
<a onclick="Share.facebook('URL','TITLE','IMG_PATH','DESC')"><img src="/images/share/facebook.png" alt=""/></a>
<a onclick="Share.mailru('URL','TITLE','IMG_PATH','DESC')"><img src="/images/share/mailru.png" alt=""/></a>
<a onclick="Share.odnoklassniki('URL','DESC')"><img src="" alt="/images/share/odnoklassniki.png"/></a>
<a onclick="Share.twitter('URL','TITLE')"><img src="/images/share/twitter.png" alt=""/></a>
http://habrahabr.ru/post/156185/
При добавлении в форму новых элементов чтобы не сбрасывались текущие значения формы изменить:
//var element=document.getElementById('elementid');
//element.innerHTML+=new_content;
$("#elementid").append(new_content);
$(document).ready(function(){
$("a[href$='.jpg'], a[href$='.png'], a[href$='.gif']").fancybox({
helpers:{
title:{
type:'over'
}
},
padding:'0',
beforeShow:function () {
var imgAlt=$(this.element).find("img").attr("alt");
var dataAlt=$(this.element).data("alt");
if (imgAlt) {
$(".fancybox-image").attr("alt",imgAlt);
} else if (dataAlt) {
$(".fancybox-image").attr("alt",dataAlt);
}
}
});
});
http://stackoverflow.com/questions/15567620/fancybox-2-1-4-alt-attribute-missing