How to use the Method Create Element (JS) in another PHP file? - javascript

I copied a mobile menu from "https://www.100percent.com/" (mobile version). My HTML local page it works fine, but when I put the code in the PHP "header.php", the solution does not work completely.
The DIV that contains the Drawer Is Visible is not created and does not appear.
The site is "https://m.intensebikeshop.com.br".
These pictures show the difference.
A: My PHP page online
B: My local HTML page
The method create 2 divs before </body>, but this tag is the footer.php file. Maybe this is the problem I am not sure.
My page is composed by 3 files (header, home-page and footer.php).
I tried using the z-index. But I think the problem is the method. I see the JS file is not creating the DIVs.
The JS file is: Theme file JS

Related

changing links in html to be ready for wordpress

So basically, I want to put my html website on wordpress, I found a way to do it without changing my html too much, however, my only issue now, is because the js and image file now have to stored in different folders, I am trying to figure out a way to automatically update the links (hrefs) in the html files with the url address of files, so when the page loads it detects the images and works properly with the scripts

Bootstrap Dropdowns will expand, but not close when included as asp file

I have created a bootstrap navigation bar that works perfectly in its own html file. The dropdowns on this file will open and close like they should. I want to include this file onto my other pages so that I don't have to update every single page's navigation bar if I ever change it. I have chosen to do this through using server side includes. My other pages are saved as asp files to allow for server side includes.
When I use
<!-- #include virtual="/navigation.html" -->
the dropdowns in the navigation are able to be expanded, but they will not go back up. Any ideas what may be going wrong?
I figured out the problem. My include files only needed the html code, no links to javascript, css, or opening and closing html,head, or body tags.

jsPDF - I need help embedding a pdf onto a web page

I'm using jsPDF to create a pdf that will be displayed on a web page but I can't seem to get it to embed correctly. The pdf does load if I put in doc.output('dataurl'); but it loads in a new window (I know that is what it's supposed to do). I made a div that uses object tags to hold the pdf and it does load a pdf file but it wont the load the jsPDF. What I'm trying to do is make an embedded pdf like the one on their main page, https://parall.ax/products/jspdf. What code would I need to add in order to get it to load in the object tags? It has to be possible since they have a working version.
p.s. I'm using JQuery if there is a quick shortcut in there.
Thank you for your help.
EDIT: Ok new problem. So I added this: $('#ID').attr("src", doc.output("dataurlstring")); It works but it makes a new problem. It doesn't always load. Sometimes it loads just fine, other times it will load the div but not the iframe or content. There aren't any errors and all my console.log() lines run. How can I fix this?

why javascript is not functioning as expected after dividing the one html file into multiple files?

I am using the following theme. when the code for the following output is saved in a single file everything(dropdown menu's of top header and left navigation bar's accordion style) is working perfectly.
When I have separated and divided the code into multiple files as top_header.php, left-nav.php, index.php and footer.php and included all the four php files into index.php, then dropdown menu's were not working.
I have added the ".js" files into all the files, drop downs were working perfectly(even though adding of files is redundant which is not good in practice).
But left navigation's accordion menu's are not working.
first make sure that you are actually calling all js files correctly (i.e. using firebug).
which javascript functions are not working exactly?
is it a jquery function like $('').click() ?
in that case You need to use event delegation to attach events for dynamically loaded elements.
have you calles the function inside a Jquery function like this (which won't work):
$(document).ready(function() {function test()});
is there any Ajax in your code?
could you show us your code to get an better idea about your problem :)

Changes made from js files are not being rendered and cannot be debugged

I have a html page (inicio.html) which loads some js scripts. Then from a js script there is a navigation to another page in a different html file (test.html) and a different set of js files.
The problem is that when I do the changePage ($.mobile.changePage("test.html");) and the new page is loaded the new js files are kept in files like
http://localhost:8080/cdmWEB/resources/scripts/jquery/2.0.3/jquery-2.0.3.min.js/eval/seq/2
The js functions are being executed because the console.log messages in them are shown. But the changes the js scripts should do in the page are not rendered and the js cannot be debuged (using firebug).
I am loading the js scripts with the tag in the html file, but I have also tried the $.getScript function with the same result.
I am using jQuery 2.0.3 and jQuery-mobile 1.3.1.
From what I saw the reason why the js files are kept like that is because they are retrieved using ajax. Is there a way to prevent this and retrieve the file "normally"? or is there something I am missing (probably)?
Have a look here:
Jquery Mobile - $.mobile.changepage not loading external .JS files
You should consider loading the needed JS in the main page, and not in the page your changing to.
I ended up using window.open('test.html','_self','',true); to make the transition. This loads the new scripts when the transition is made and the jquery appends keep working fine.

Categories

Resources