0

你能告诉我当用户滚动它时如何获得一个事件 div 竞争结束。当用户进入 div 竞争结束时我需要做一些任务。显示一个警报。它只在用户走到最后时显示警报抗衡。

这是我的小提琴 http://jsfiddle.net/naveennsit/prUYP/5/

<div data-role="page" id="test">
    <div id="test" class="left test_h" style="width:97%;">
        Sachin Ramesh Tendulkar AM (Listeni/səˈtʃɪn tɛnˈduːlkər/; born 24 April 1973)[1] is an Indian cricketer widely acknowledged as one of the greatest batsmen in One Day International cricket[2] In 2002, Wisden Cricketers' Almanack ranked him the second greatest Test batsman of all time, behind Don Bradman, and the second greatest one-day-international (ODI) batsman of all time, behind Viv Richards.[3] Tendulkar was a part of the 2011 Cricket World Cup winning Indian team in the later part of his career, his first such win in six World Cup appearances for India.[4] He was also the recipient of "Player of the Tournament" award of the 2003 Cricket World Cup held in South Africa. Tendulkar won the 2010 Sir Garfield Sobers Trophy for cricketer of the year at the ICC awards.[5] He has been recommended for the receipt of the Bharat Ratna award, in fact it has been speculated that the criteria for the award of the Bharat Ratna were changed to allow him receive the award.[6][7] He is also a member of Rajya Sabha of Parliament of India.[8] Tendulkar passed 30,000 runs in international cricket on 20 November 2009. On 5 December 2012, Tendulkar became first batsman in history to cross the 34,000 run aggregate in all formats of the game put together.[9][10][11] At 36 years and 306 days, he became the first ever player to score a double-century in the history of ODIs. Two years later he became the first player to score 100 international centuries. As of June 2013, Tendulkar has played 662 matches in international cricket.[12] Tendulkar has been honoured with the Padma Vibhushan award, India's second highest civilian award, and the Rajiv Gandhi Khel Ratna award, India's highest sporting honour. He was also the first sportsperson and the first one without aviation background to be awarded the honorary rank of Group Captain by the Indian Air Force. Tendulkar has received honorary doctorates from University of Mysore and Rajiv Gandhi University of Health Sciences.[13][14] Sachin holds the 19th rank in ICC Player Rankings for Test batsmen as of 17 March 2013.[15] On 1 August 2012, Sachin Tendulkar was nominated for the ICC People's Choice award for the third time.[16] In 2012, he was nominated to Rajya Sabha, the upper house of the Parliament of India.Sachin tendulkar was ranked 78th richest sportsman in the world according to the Forbes' list of world's highest-paid athletes for the year 2012.[17] In June 2013 list, Forbes rankes Sachin at 51st position in highest paid athletes list, with his total earnings were estimated to be USD 22 million.[18][19][20] Sachin Tendulkar was named as an Honorary Member of the Order of Australia in 2012.[21] On 23 December 2012, Tendulkar announced his retirement from ODIs.[22][23][24][25] Tendulkar has already stated that he will not be playing T20 
        <span class="cursor" style="font-size:23px;">|</span>    
    </div>
</div>
4

2 回答 2

1

尝试这个

$('#realTimeContents').on('scroll', function () {
    if ($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight) {
        alert('Ends');
    }
});

您的 HTML 几乎没有变化。

ID 是唯一的,因此请更改您的 HTML,如下所示,

<div data-role="page" id="test">
    <div id="realTimeContents" class="left test_h" style="width:97%;">

检查这个JSFiddle

于 2013-08-08T06:06:36.450 回答
0

你可以使用 javascript

$(window).scroll(function(){
    if($(document).height() > $(window).height())
    {
        if($(window).scrollTop() == $(document).height() - $(window).height()){
          alert("The Bottom");
        }
    }
});

代码

于 2013-08-08T06:03:14.267 回答