Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

if window width jquery then display a div at scroll

function updateContainer() {
    $(window).scroll(function() {

        if ( $(window).width() > 960 ) {

            if( $(window).scrollTop() > 40 && $(document).height() - $(window).height() > 79 ) { // scroll bug appears if 78 or lower
                add_desktop();
            } else if ($(window).scrollTop() <= 40 ) {
                remove_desktop();
            }

        } else {

            if( $(window).scrollTop() > 40 && $(document).height() - $(window).height() > 160 ) {
                add_mobile();
            } else if ($(window).scrollTop() <= 40 ) {
                remove_mobile();
                //alert (winwidth);
            }

        }

    });

}
Comment

PREVIOUS NEXT
Code Example
Javascript :: ng-if variable is undefined 
Javascript :: javascript range between two numbers 
Javascript :: javascript hide elements by class 
Javascript :: joi validation enum 
Javascript :: how to get url parameter using jquery or plain javascript 
Javascript :: javascript design patterns pdf 
Javascript :: next js page 
Javascript :: how to delete a message by its id discord.js 
Javascript :: usecontext hook react 
Javascript :: insert element at beginning of array javascript 
Javascript :: js use restrict 
Javascript :: capitalize all letters jquery 
Javascript :: list keys json python 
Javascript :: javascript allow default 
Javascript :: jquery validation on click 
Javascript :: angular autocomplete displaywith 
Javascript :: @apify/http-request 
Javascript :: jquery get all classes of a div 
Javascript :: deprecationwarning: mongoose 
Javascript :: find items from array of ids mongoose 
Javascript :: input events 
Javascript :: us postal code regex 
Javascript :: send sms using twilio in node 
Javascript :: what is side effect 
Javascript :: express octet stream 
Javascript :: jquery get custom attribute 
Javascript :: nodejs delete in mysql 
Javascript :: create empty json file python 
Javascript :: make property read-only javascript 
Javascript :: js timezone location 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =