MyBB Community Forums

Full Version: Adding a modal login box to MyBB using jQuery
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
Euan T

whether, this javascript code should be updated Huh

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
You can do if you want. If you need something from 1.9, feel free to update it. This script should still work ok.
what suggestions do you have to change it to the new version?
and
nothing should be changed in addition to changing the javascript version?
Its best to keep your jQuery library up-to-date. I myself use this script along with jQuery 1.9.1 and it works like a breeze.
I've already done to it Toungue
Thanks
Cool even though my theme already has a pop up login box :p
My theme is really still no animation plain javascript
and from now on I modify whole
thank you
man i need some help im trying to do a on load resize......... nothing happens... i know its related but i cant get jquery to work on mybb please help Sad

function loadjsfile(filename, filetype){
      if (filetype=="js"){ //if filename is a external JavaScript file
      var fileref=document.createElement('script')
      fileref.setAttribute("type","text/javascript")
      fileref.setAttribute("src", filename)
      }
      }
      if (typeof fileref!="undefined")
      document.getElementsByTagName("head")[0].appendChild(fileref)
    }
    // load
    loadjscssfile("http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js", "js")
    var currentWidth = $(document.body).width();
    var targetWidth = 1050; // experiment for your self
    var scrollWidth = 10; // need to make it dynamic
    // if the screen is not bigger than the target, then don't mess with zooming
    if (currentWidth > targetWidth) {
      if (typeof document.body.style.zoom != "undefined")
        document.body.style.zoom = currentWidth / targetWidth;
      else if (typeof document.body.style.MozTransform != "undefined") {
        document.body.style.MozTransformOrigin = "left top";
        document.body.style.MozTransform = 'scale(' + currentWidth / targetWidth + ')';
      }
      else if (typeof document.body.style.WebkitTransform != "undefined")
        document.body.style.WebkitTransform = 'scale(' + currentWidth / targetWidth + ')';

      $(document.body).width(targetWidth - scrollWidth);
   }
code for what you use?
For example this code in firefox's webdeveloper tools 'scratch pad' works perfect:

var GMJQ = document.createElement('script'); GMJQ.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'; GMJQ.type = 'text/javascript'; document.getElementsByTagName('head')[0].appendChild(GMJQ);
var currentWidth = $(document.body).width();
    var targetWidth = 1100; // experiment for your self
    var scrollWidth = 10; // need to make it dynamic
    // if the screen is not bigger than the target, then don't mess with zooming
    if (currentWidth > targetWidth) {
      if (typeof document.body.style.zoom != "undefined")
        document.body.style.zoom = currentWidth / targetWidth;
      else if (typeof document.body.style.MozTransform != "undefined") {
        document.body.style.MozTransformOrigin = "left top";
        document.body.style.MozTransform = 'scale(' + currentWidth / targetWidth + ')';
      }
      else if (typeof document.body.style.WebkitTransform != "undefined")
        document.body.style.WebkitTransform = 'scale(' + currentWidth / targetWidth + ')';

      $(document.body).width(targetWidth - scrollWidth);
   }

Now no matter which way I try to include jquery 1.9.1 min library into mybb and an on load or ready and then this script... nothing happens...

Tried in header, tried in 'header includes' template, tried in the index and directly in the <head> but nothing...

I hope I can figure this out so it's helpful for some people.. it basically resizes/scales/zoom page no matter what the person's resolution even though the site is designed for 1024x768 width, it will scale it to fit even on the largest of screens in width so no space is wasted, only slight empty space on edges (which is what i wanted in design).
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26