You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
734 B
35 lines
734 B
/**
|
|
* 触发单击事件
|
|
* @param elem 需要触发事件的DOM对象
|
|
*/
|
|
function fireClickEvent(elem)
|
|
{
|
|
var event;
|
|
if(window.MouseEvent) event = new MouseEvent('click');
|
|
else
|
|
{
|
|
event = document.createEvent('MouseEvents');
|
|
event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
|
}
|
|
elem.dispatchEvent(event);
|
|
}
|
|
|
|
|
|
var winX = null;
|
|
var winY = null;
|
|
|
|
window.addEventListener('scroll', function () {
|
|
if (winX !== null && winY !== null) {
|
|
window.scrollTo(winX, winY);
|
|
}
|
|
});
|
|
|
|
function disableWindowScroll() {
|
|
winX = window.scrollX;
|
|
winY = window.scrollY;
|
|
}
|
|
|
|
function enableWindowScroll() {
|
|
winX = null;
|
|
winY = null;
|
|
}
|