Comments (6)
Can you be more specific about what you are looking for? Are you looking for examples in the documentation, or in the demo? Any particular event(s)?
from jquery-mobile-iscrollview.
It will be good if will be added more examples with using events/methods/properties. For my case, I can not listen any event.
My code:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=1" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css" />
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js"></script>
<link rel="stylesheet" href="css/jquery.mobile.iscrollview.css" />
<script src="js-libs/jquery.actual.min.js"></script>
<script src="js-libs/iscroll.js"></script>
<script src="js-libs/jquery.mobile.iscrollview.js"></script>
<script>
$(document).bind('pageinit', function() {
console.log('pageinit');
var $sa = $('#srollarea');
$sa.live("iscroll_onscrollstart", function(e) {
console.log('live');
});
$sa.bind("iscroll_onscrollstart", function(e) {
console.log('bind');
});
$sa.on("iscroll_onscrollstart", function(e) {
console.log('on');
});
$('.iscroll-view').bind('iscroll_onscrollstart', function(e) {
console.log('live2');
});
$('.iscroll-view').bind('iscroll_onscrollstart', function(e) {
console.log('bind2');
});
$(document).delegate('.iscroll-view', 'iscroll_onscrollstart', function(e, d) {
console.log('delegate');
});
});
</script>
</head>
<body>
<div data-role='header'><p>Header</p></div>
<div data-role="page" data-dom-cache="true">
<div id="srollarea" data-iscroll>
<div>
<ul data-role="none">
<li> 1 </li>
<li> 2 </li>
<li> 3 </li>
</ul>
</div>
</div>
</div>
</body>
</html>
thnx for help
from jquery-mobile-iscrollview.
See pull-example.hs for an example of binding to an iscrollview event.
If you're binding from JS code embedded in the page itself, don't wrap it in a pageinit
callback. That code will never run, because pageinit
has already occurred when the JS code in the page is defined. Also, you need to insure that the JS code is at the end of the page.
I prefer to do all my binding/delegating from JS code called from <head>
. Then I can delegate looking for the creation of a specific page and bind to elements on that page, or else just delegate elements to the document. (The latter is somewhat less efficient, since the events have to bubble all the way up.)
By the way, you no longer need to include jquery.actual in your <head>
. It is no longer used as of 1.2.
from jquery-mobile-iscrollview.
Hmm...
Sorry but I can not binding to any events. I just add to examples code(pull-example.js) my code and I don't retrieve events:
function onScrollStart(event, data) {
console.log('iscroll_onscrollstart occured');
}
$(document).delegate("div.short-pull-demo-page", "iscroll_onscrollstart", function(event, data) {
var v = data.iscrollview; // In case we need to reference the iscrollview
console.write("iscroll_onscrollstart occured");
});
$(document).delegate("div.short-pull-demo-page", "pageinit",
function bindShortPullPagePullCallbacks(event) {
$(".iscroll-wrapper", this).bind( {
iscroll_onpulldown : onPullDown,
iscroll_onpullup : onPullUp,
iscroll_onscrollstart : onScrollStart
} );
});
from jquery-mobile-iscrollview.
- Make sure you have updated to the latest version. There was a bug in the iScroll events. (Not the widget events like
iscroll_onpulldown
, but events generated by iScroll itself, likeiscroll_onscrollstart
). - Where did you put the code shown above? As I pointed-out earlier, this will not work if it is in the HTML file.
If you put this in the HTML file itself, make sure it is the last thing in <body>
(not <head>
) and just call .bind()
. The delegation code above will not work in the HTML file itself because when the code is executed, the pageinit
event has already occurred.
$(".iscroll-wrapper", $.mobile.activePage).bind(...)
- If your code is executed from
<head>
, (like pull-example.js is) then the way you have done it will work. The second way (like in pull-example.js) is more efficient, because the event doesn't have to bubble-up to the document. (i.e. just bound directly to the wrapper, the same as the code I show above for executing the code in the HTML file.)
from jquery-mobile-iscrollview.
I've added several examples of how to bind to events in the documentation.
from jquery-mobile-iscrollview.
Related Issues (20)
- how can I programmatically open up pullDown HOT 1
- Issue with AngularJS?
- IScroll 5 support HOT 3
- jquery-mobile-iscrollview as Bower package
- It's not working with phone gap. HOT 1
- Cannot set option fadeScrollbars HOT 1
- IE page width issue - plz add this css fix
- Searching a JS for small freelancer work HOT 1
- width shrinked to zero on some Android Devices HOT 1
- PullDown showing during Page transition (Jquerymobile and Backbone) HOT 1
- Support for IE on Windows Surface RT HOT 8
- Weird height issue HOT 1
- iscrollview inside of an external jqm panel HOT 2
- Weird width problem HOT 4
- Scroll not Working in Safari 9.0 (10601.1.56.2)
- Issue with Cordova App after deploying to IOS 9 HOT 2
- The rest of the page won't scroll if a page has an iscroll div in it, iPad & iPhone
- It doesn't support PC browser :( HOT 1
- swipe event blocked HOT 1
- Trouble applying the pull down refresh action in Cordova InAppbrowser WebView?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquery-mobile-iscrollview.