if window width jquery then display a div at scroll

Solutions on MaxInterview for if window width jquery then display a div at scroll by the best coders in the world

showing results for - "if window width jquery then display a div at scroll"
Cindy
16 Sep 2019
1function updateContainer() {
2    $(window).scroll(function() {
3
4        if ( $(window).width() > 960 ) {
5
6            if( $(window).scrollTop() > 40 && $(document).height() - $(window).height() > 79 ) { // scroll bug appears if 78 or lower
7                add_desktop();
8            } else if ($(window).scrollTop() <= 40 ) {
9                remove_desktop();
10            }
11
12        } else {
13
14            if( $(window).scrollTop() > 40 && $(document).height() - $(window).height() > 160 ) {
15                add_mobile();
16            } else if ($(window).scrollTop() <= 40 ) {
17                remove_mobile();
18                //alert (winwidth);
19            }
20
21        }
22
23    });
24
25}
26