WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] html js not working in wp (28 posts)

  1. emaarkhan
    Member
    Posted 1 year ago #

    hi,
    I m converting my html site to WP and i am trying to make the slide work which works perfectly in html website.i tried jQuery simple alert it works but the script isn't.wht seem to be wrong?

  2. Pankaj Pandey
    Member
    Posted 1 year ago #

    your script is commented remove // before line

  3. emaarkhan
    Member
    Posted 1 year ago #

    yes it removed. the version i showed as an example was when it was doing nothing. the comments are removed.

  4. Pankaj Pandey
    Member
    Posted 1 year ago #

    can you share url?

  5. emaarkhan
    Member
    Posted 1 year ago #

    its on localhost. i think you can run that script on ur local environment too.can?

  6. Pankaj Pandey
    Member
    Posted 1 year ago #

    i can run that script but i want to see the html.

  7. Pioneer Valley Web Design
    Member
    Posted 1 year ago #

    its on localhost. i think you can run that script on ur local environment too.can?

    What OS? What Browser? Which AV? Typically local host blocks running unknown scripts

  8. emaarkhan
    Member
    Posted 1 year ago #

    i can run that script but i want to see the html.

    here

    What OS? What Browser? Which AV? Typically local host blocks running unknown scripts

    Mac OS. Firefox, what's AV.well as for now i m pasting that code in header.php, as i had some issue that my script.js won't load.so first i did a jquery alert. when that worked in header.i pasted that

  9. Pankaj Pandey
    Member
    Posted 1 year ago #

    seems wrong $fw("#galleryhdr") change that to $("#galleryhdr")

  10. emaarkhan
    Member
    Posted 1 year ago #

    No, that didn't work. did it worked on ur end?

  11. Pankaj Pandey
    Member
    Posted 1 year ago #

    give me code of header.php

  12. emaarkhan
    Member
    Posted 1 year ago #

    give me code of header.php


    here

  13. emaarkhan
    Member
    Posted 1 year ago #

    if your wondering, why didn't i put the code in script.js as directed in header file. the script.js wasn't loading.so i check to see if the jquery is working and it was. so i managed to put the code in header. so it work

  14. Pankaj Pandey
    Member
    Posted 1 year ago #

    Where is jquery.js and where is fwShowcase.js?

  15. emaarkhan
    Member
    Posted 1 year ago #

    jquery is loading from wp-include using

    function my_scripts_method() {
    	wp_enqueue_script(
    		'newscript',
    		plugins_url('/scripts/script.js', __FILE__),
    		array('jquery')
    	);
    }
    add_action('wp_enqueue_scripts', 'my_scripts_method');

    as for the fwShowcae.js, i missed that but its added after script.js
    like`<script type="text/javascript" src="scripts/fwShowcase.js"></script>
    <script type="text/javascript" src="scripts/fwShowcasea.js"></script>
    <script type="text/javascript" src="scripts/fwShowcasec.js"></script>`

  16. Pankaj Pandey
    Member
    Posted 1 year ago #

    make sure fwShowcase.js is properly loaded before script.js

  17. Pankaj Pandey
    Member
    Posted 1 year ago #

    also i request can you share view source of your developed page

  18. emaarkhan
    Member
    Posted 1 year ago #

    I have doubts on my scripts actually being called from scripts folder. have a look at this screenshot, when i click script files. it is opening same page again and the title of the page is adding /script/script. what could be wrong?
    I also went ahead and pasted fwshowcase.js and pasted it in header but nothing happened.
    is it working on ur end?

  19. emaarkhan
    Member
    Posted 1 year ago #

    I don't have it uploaded.its on localhost. which page u want me to show u

  20. emaarkhan
    Member
    Posted 1 year ago #

    I used the <?php bloginfo('template_url'); ?> in front of the scripts and its working.

  21. emaarkhan
    Member
    Posted 1 year ago #

    Thanks guys! especially pankaj!

  22. emaarkhan
    Member
    Posted 1 year ago #

    Pankaj, i have a question. how did u know it was request fdshowcase. sorry i m very new to js

  23. Pankaj Pandey
    Member
    Posted 1 year ago #

    you have to learn javascript.
    your script.js need jquery and fdshowcase.js to run

    jQuery(function(){ this line say it must need jquery
    $fw("#galleryhdr").fwShowcase( this line say you fwShowcase plugin

  24. emaarkhan
    Member
    Posted 1 year ago #

    I have another js accordian heading. its not working now.i have put it in the visual editor. do u think putting it in visual editor is problem or shld i hard code it to make it work? as i looked into old static page. it sas heading2, which has one css class and other r two p heading with same class

  25. Pankaj Pandey
    Member
    Posted 1 year ago #

    putting it in visual editor is problem. better you can design a page template for your theme

  26. emaarkhan
    Member
    Posted 1 year ago #

    yes i did that but no results :(

  27. emaarkhan
    Member
    Posted 1 year ago #

    actually its a conversion from static to dynamic. so i want all things to be the same.
    Its the same script as before. the h2 part if u see. its that one. bt its working

    [No bumping. If it's that urgent, consider hiring someone.]

  28. emaarkhan
    Member
    Posted 1 year ago #

    thnx anyways

Topic Closed

This topic has been closed to new replies.

About this Topic