Jquery දන්න කෙනෙක් මේ ස්ක්‍රිප්ට් එක බලල කියනව&#3503

WaterMelon

Active member
  • Aug 1, 2017
    377
    182
    43
    Jquery දන්න කෙනෙක් මේ ස්ක්‍රිප්ට් එක බලල කියනව&#3503

    මේ ස්ක්‍රිප්ට් එක පොඩ්ඩක් බලන්න මචන්,
    https://www.w3schools.com/code/tryit.asp?filename=FOK7620F9WEI
    https://www.w3schools.com/code/tryit.asp?filename=FOK7620F9WEI
    Jquery වලින් තියෙන්නෙ,
    ගෙයක ඉමේජ් එක තියෙන පොපප් එක ක්ලික් කලාම,ගෙය තියෙන පොපප් එක close වෙලා Email ඇන්ඩ් Address සබ්මිට් ෆොර්ම් එක popup වෙන්න ඕනෙ, එත් ඒක popup වෙන්නෙ නැහැ...
     
    Last edited:

    Lakshan-Seram

    Well-known member
  • May 31, 2011
    24,761
    12,695
    113
    127.0.0.1:8080/Kandy
    Fix eka thama
    PHP:
     $("#popup").on('click', function() {
    }
    ube CSS selector eka weradi.

    Oka fix karath oke issues tiyenawa ban. Oita wada hoda kramayak balanna.


    Update 2
    PHP:
    $(function() {
        openUp('#overlay')
        $("#popup").on('click', function() {
            openUp('#overlay2')
            closeDown('#overlay')
        });
    
        function openUp(el) {
            $(el).fadeIn(500, function() {
                $(this).next().show();
            });
        }
    
        function closeDown(el) {
            $(el).fadeOut(500, function() {
                $(this).next().hide();
            });
        }
        
        /*
         * Disable <a> click event which is causing page redirect.
         * !!! Bad practice this is just only a fix for this code !!!
         */
        $( 'a' ).each(function(index, element) {
            $ ( this ).click( function ( e ) {
                e.preventDefault();
            });
        });
    });

    https://www.w3schools.com/code/tryit.asp?filename=FOKRHANG9KEP
     
    Last edited:
    • Like
    Reactions: WaterMelon

    WaterMelon

    Active member
  • Aug 1, 2017
    377
    182
    43
    Fix eka thama
    PHP:
     $("#popup").on('click', function() {
    }
    ube CSS selector eka weradi.

    Oka fix karath oke issues tiyenawa ban. Oita wada hoda kramayak balanna.


    Update 2
    PHP:
    $(function() {
        openUp('#overlay')
        $("#popup").on('click', function() {
            openUp('#overlay2')
            closeDown('#overlay')
        });
    
        function openUp(el) {
            $(el).fadeIn(500, function() {
                $(this).next().show();
            });
        }
    
        function closeDown(el) {
            $(el).fadeOut(500, function() {
                $(this).next().hide();
            });
        }
        
        /*
         * Disable <a> click event which is causing page redirect.
         * !!! Bad practice this is just only a fix for this code !!!
         */
        $( 'a' ).each(function(index, element) {
            $ ( this ).click( function ( e ) {
                e.preventDefault();
            });
        });
    });

    https://www.w3schools.com/code/tryit.asp?filename=FOKRHANG9KEP

    Thanks machan...this looks ok, is there any workaround to make this responsive?

    can't see well on mobile...( image looks big and not aligned well )
     

    WaterMelon

    Active member
  • Aug 1, 2017
    377
    182
    43