- 檔案系統模組
- PhantomJS - 屬性
- PhantomJS - 方法
- 系統模組
- PhantomJS - 屬性
- Web 伺服器模組
- PhantomJS - 屬性
- PhantomJS - 方法
- 其他
- 命令列介面
- PhantomJS - 螢幕截圖
- PhantomJS - 頁面自動化
- PhantomJS - 網路監控
- PhantomJS - 測試
- PhantomJS - REPL
- PhantomJS - 示例
- PhantomJS 有用資源
- PhantomJS - 快速指南
- PhantomJS - 有用資源
- PhantomJS - 討論
PhantomJS - scrollPosition 屬性
這包含指示滾動位置的物件。它給出左右。你可以更改左右的值來改變頁面滾動位置。或者,只讀取值來了解頁面滾動位置。
語法
其語法如下 −
var wpage = require('webpage').create()
wpage.scrollPosition;
示例
讓我們舉個例子來理解使用scrollPosition 屬性。
var wpage = require('webpage').create();
wpage.open('https:///tasks/page1.html', function (status) {
console.log(JSON.stringify(wpage.scrollPosition));
wpage.scrollPosition = {
top:500,
left:30
}
console.log(JSON.stringify(wpage.scrollPosition));
phantom.exit();
});
以上程式生成以下輸出。
{"left":0,"top":0}
{"left":30,"top":500}
phantomjs_webpage_module_properties.htm
廣告