2016-05-22 118 views
0

我正在使用此功能在我的网站中打开弹出窗口。 我想向右滚动(这是RTL)窗口的内容,但它不是工作:如何滚动右侧弹出窗口

popupWins[name].scrollRight += 1000; 

任何想法?

popupWins = new Array(); 

function windowOpener(url, name, args) { 
/******************************* 
the popupWins array stores an object reference for 
each separate window that is called, based upon 
the name attribute that is supplied as an argument 
*******************************/ 
if (typeof(popupWins[name]) != "object"){ 
popupWins[name] = window.open(url,name,args); 
} else { 
if (!popupWins[name].closed){ 
popupWins[name].location.href = url; 
} else { 
popupWins[name] = window.open(url, name,args); 
} 
} 

popupWins[name].scrollRight += 1000; 
popupWins[name].focus(); 


} 
+0

你试过popupWins [名] .scrollLeft + = 1000? –

+0

添加setTimeout有帮助吗? –

回答

0

试试这个代码

popupWins[name].document.body.scrollLeft += 1000; 
+0

只有当我多次打开窗户时才有效。第一次不起作用/ – user1797901

+1

当我第一次调用函数时它不起作用。当我多次打电话(该窗口已经打开)时,它可以工作。 – user1797901

+0

可能需要使用setTimeout函数添加一个小延迟,因为第一次可能需要一些时间才能加载页面... –