18 февраля 2015
Нет комментариев
.jcarousel({wrap:'circular'})
.jcarousel({wrap:'circular'})
function validateEmail(email) { var re=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(email); }
Например для отправки формы вместо:
$(document).ready(function(){ $('.formclass').submit(function(){ alert(1); }); });
нужно:
$(document).ready(function(){ $('.formclass').live('submit',function(){ alert(1); }); });
function addLink() { var body_element=document.getElementsByTagName('body')[0]; var selection; selection=window.getSelection(); var pagelink="<br/><br/>Источник: <a href='"+document.location.href+"'>"+document.location.href+"</a><br/><br/>"; var copytext=selection+pagelink; var newdiv=document.createElement('div'); newdiv.style.position='absolute'; newdiv.style.left='-99999px'; body_element.appendChild(newdiv); newdiv.innerHTML=copytext; selection.selectAllChildren(newdiv); window.setTimeout(function() { body_element.removeChild(newdiv); },0); } document.oncopy=addLink;
В примере устанавливаем для всех элементов с class catalog_item высоту самого высокого.
function setEqualHeight(columns){ var tallestcolumn=0; columns.each( function(){ currentHeight=$(this).height(); if(currentHeight>tallestcolumn) { tallestcolumn=currentHeight; } } ); columns.height(tallestcolumn); } $(window).load(function() { setEqualHeight($(".catalog_item")); });
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; }
var scrollTop=window.pageYOffset||document.documentElement.scrollTop;