Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. General Discussion
  3. Javascript accordion

Javascript accordion

Scheduled Pinned Locked Moved General Discussion
11 Posts 2 Posters 2.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MAN
    wrote on last edited by
    #1

    Hi! Congratulations for this wonderful theme.

    I'm trying to add this accordion: http://uniondesign.ca/simple-accordion-without-jquery-ui/ to my website.

    I'm using the HTML in the "code" field inside the "+ Text" option, the script in "custom <head>", and the css in "Custom CSS for Desktop Version". It isn't working, what am I doing wrong?

    Thanks in advance!

    1 Reply Last reply
    0
    • arminunruhA Offline
      arminunruhA Offline
      arminunruh
      Global Moderator
      wrote on last edited by
      #2

      I don't know. Does it work when you are on the page where the accordion is and you just refresh?

      1 Reply Last reply
      0
      • arminunruhA Offline
        arminunruhA Offline
        arminunruh
        Global Moderator
        wrote on last edited by
        #3

        Ok I think I know why it doesn't work. You shouldn't use $(document).ready(function($) { }); but try

        Frontend.module("GlobalEvents").on('projectpageshown', function(){
        
        });
        

        Your js goes inside that function. U can try that!

        1 Reply Last reply
        0
        • M Offline
          M Offline
          MAN
          wrote on last edited by
          #4

          Hey Armin, thanks for your answer. I finally desisted with the accordion, but I'm still having problems using any javascript. I'm using a row background image as a front page cover and I want it to fade in when it loads.

          I'm trying with:

          <script>
          Frontend.module("GlobalEvents").on('projectpageshown', function(){
          $('#main-region').fadeIn();
          });
          </script>
          

          And CSS:

          #main-region {
          display: none; 
          }
          

          And it's not working. Any ideas?
          Thanks for your help, cheers!

          1 Reply Last reply
          0
          • arminunruhA Offline
            arminunruhA Offline
            arminunruh
            Global Moderator
            wrote on last edited by
            #5
            #main-region {
            display: none!important; 
            }
            

            Maybe like this?

            M 1 Reply Last reply
            0
            • arminunruhA arminunruh
              #main-region {
              display: none!important; 
              }
              

              Maybe like this?

              M Offline
              M Offline
              MAN
              wrote on last edited by
              #6

              @arminunruh The CSS is working, the problem is in the script... How would you do a fadein load for the background image, anyway? Thanks!

              1 Reply Last reply
              0
              • arminunruhA Offline
                arminunruhA Offline
                arminunruh
                Global Moderator
                wrote on last edited by arminunruh
                #7

                You can use "Lay Options" -> "Intro" to create a frontpage cover.
                Well, it's hard to say from here what's wrong with your JavaScript. Do you get any errors in your console, what happens?

                JS in general should run fine.
                Maybe it's easier if you insert your custom HTML with the "Lay Options" -> "Misc Options" -> "HTML at Top" field.

                And I don't really get what you mean with this:

                I'm using a row background image as a front page cover and I want it to fade in when it loads.

                A row background image is part of the grid which is inside of #main-region. It seems like you are trying to hide #main-region with CSS and then show it using JS and I'm not sure if that makes any sense.

                M 1 Reply Last reply
                0
                • arminunruhA arminunruh

                  You can use "Lay Options" -> "Intro" to create a frontpage cover.
                  Well, it's hard to say from here what's wrong with your JavaScript. Do you get any errors in your console, what happens?

                  JS in general should run fine.
                  Maybe it's easier if you insert your custom HTML with the "Lay Options" -> "Misc Options" -> "HTML at Top" field.

                  And I don't really get what you mean with this:

                  I'm using a row background image as a front page cover and I want it to fade in when it loads.

                  A row background image is part of the grid which is inside of #main-region. It seems like you are trying to hide #main-region with CSS and then show it using JS and I'm not sure if that makes any sense.

                  M Offline
                  M Offline
                  MAN
                  wrote on last edited by
                  #8

                  @arminunruh I'm creating a one-page portfolio where the first row is a fullscreen pic. The problem is that it makes a sudden appearance after 1 sec of blank space. The non background images load smoothly.

                  Any idea about how to get this fadein effect? Thanks again.

                  1 Reply Last reply
                  0
                  • arminunruhA Offline
                    arminunruhA Offline
                    arminunruh
                    Global Moderator
                    wrote on last edited by arminunruh
                    #9

                    Awh ok, now I know what you mean.
                    Hm, it's not really easy to do that. The fullbleed images are not faded in because they are background images of rows and background images can't have opacity.

                    Well set the opacity of the row to 0 with CSS. Specify a CSS transition for the opacity of the first row and then set the opacity to 1 with js.

                    1 Reply Last reply
                    0
                    • arminunruhA Offline
                      arminunruhA Offline
                      arminunruh
                      Global Moderator
                      wrote on last edited by arminunruh
                      #10

                      hey MAN! I just tested it and realized this event "projectpageshown" is only triggered when you navigate to a new page, not on initial load.

                      Well then you're probably better off using jquery document ready.
                      Making it easier to use ur own js is def something I need to work on and write a little tutorial about in "how to use" for a later update.

                      edit: Ok it just didnt work cause my page was empty -.-

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        MAN
                        wrote on last edited by
                        #11

                        Sorry I'm late, I didn't see your answer. Yes, some kind of tutorial would be useful for non-professional coders as I am...
                        I think a great use for fullscreen row is to use it like a cover, so I think would be great to improve its loading... otherwise the feeling is so tough.

                        Anyway, I'm enjoying a lot using Lay, congrats again for your work!

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        I also code custom websites or custom Lay features.
                        šŸ’æ Email me here: šŸ’æ
                        info@laytheme.com

                        Before you post:
                        1. When using a WordPress Cache plugin, disable it or clear your cache.
                        2. Update Lay Theme and all Lay Theme Addons
                        3. Disable all Plugins
                        4. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"

                        This often solves issues you might run into

                        When you post:
                        1. Post a link to where the problem is
                        2. Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
                        3. If the problem is difficult to explain, post screenshots / link to a video to explain it
                        Online Users
                        Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
                        laytheme.com
                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Search