Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

JS Assistance Please

  • 20-12-2016 8:05am
    #1
    Registered Users, Registered Users 2 Posts: 874 ✭✭✭


    So I inherited this site which is a bit of a code soup, not helped by my lack of expertise in js. I need to add a modal and opted for one called Remodal which will do the trick nicely. Problem is it seems be conflicting with one of the many existing scripts on the page. Here’s the very simplified version of the page:

    <!doctype html>
    <html class="no-js" lang="en">
    <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    
    
    <script src="https://cdn.jsdelivr.net/g/jquery@1.7.1"></script>
    
    <script src="/js/screen.js" type="text/javascript"></script>
    
    </head>
    
    
    <body>
    
    
    
    <!-- Modal Box Code -->
    <div class="remodal" data-remodal-id="mayomodal">
    <button data-remodal-action="close" class="remodal-close"></button>
    
    MODAL CONTENT HERE
    
    </div>
    <!-- // Modal Box Code -->
    
    
    
    <script src="https://cdn.jsdelivr.net/remodal/1.1.0/remodal.min.js"></script>
    </body>
    </html>
    

    So by a process of elimination I believe that screen js is the culprit that prevents the Remodal script from working. The content of screen js can be seen here: http://pastebin.com/yp0YzfZc


    If anybody has any ideas as to what’s going on here and can explain in simple terms it would be much appreciated.

    Thanks


Comments

  • Registered Users, Registered Users 2 Posts: 1,029 ✭✭✭John_C


    Can you set up your example in one of the demo sites like codepen?
    That'll make it much easier for people to see the error and offer help.


  • Moderators, Society & Culture Moderators Posts: 17,643 Mod ✭✭✭✭Graham


    So I inherited this site which is a bit of a code soup, not helped by my lack of expertise in js. I need to add a modal and opted for one called Remodal which will do the trick nicely. Problem is it seems be conflicting with one of the many existing scripts on the page. Here’s the very simplified version of the page:

    That snippet is only slightly more useful than a photograph of the web page.

    You need to either upload a page somewhere or at least share the error messages.


  • Registered Users, Registered Users 2 Posts: 6,289 ✭✭✭Talisman


    You could start by bumping up the version of the jQuery library - jQuery 1.7.1 was released in 2011. You've chosen to use a plugin that was developed in 2015 so jQuery 1.11/1.12 is most likely the minimum version it was developed against.
    <script
      src="http://code.jquery.com/jquery-1.12.4.min.js"
      integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ="
      crossorigin="anonymous"></script>
    


  • Registered Users, Registered Users 2 Posts: 874 ✭✭✭devildriver


    Thanks guys.
    John_C wrote: »
    Can you set up your example in one of the demo sites like codepen?
    That'll make it much easier for people to see the error and offer help.

    Yes, I literally facepalmed when I realised that I should have tried to set it up on Codepen. I'm going to blame that on the early hours and not having had my coffee.

    @Graham. Yes you're right. I've actually had clients send me photos of their screens!

    @Talisman. Remodal actually works fine with JQ 1.7.1 so that's not the issue. I do realise that it's all out of date but I'm proceeding carefully so as not to cause any more problems.

    My setup on Codepen actually worked - I think by dropping Jquery to the end of the page instead of the head but the issue with the menu still prevails. Back to the drawing board!


Advertisement