Author Topic: Problem with javascripts  (Read 47566 times)

Offline rumen

  • Posts: 399
Problem with javascripts
« on: September 27, 2014, 11:14:10 PM »
Most of the javasripts doesn't start .... I have CaptionSlider that works properly. But I have a form which is sliding panel and doesn't work at all. I installed jqCollapse and when I put Title and Content - the title appears on the screen but when you click nothing happens.

Here is the code of the header of the template:

Code: [Select]
<?php

if (!defined('WB_PATH')) die(header('Location: ../../index.php'));

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN" lang="EN" dir="ltr">
<head>
<title><?php page_title(); ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
if(defined('DEFAULT_CHARSET')) { echo DEFAULT_CHARSET; } else 
{ echo 
'utf-8'; }?>
" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="description" content="<?php page_description(); ?>" />
<meta name="keywords" content="<?php page_keywords(); ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo TEMPLATE_DIR?>/styles/layout.css" media="screen" />
<!-- <link rel="stylesheet" href="styles/layout.css" type="text/css" /> -->
<script type="text/javascript" src="jquery-1.4.1.min.js"></script>
<script type="text/javascript" src="jquery.slidepanel.setup.js"></script>
<script type="text/javascript" src="jquery.cycle.min.js"></script>
<script type="text/javascript" src="jquery.cycle.setup.js"></script>
<script src="<?php echo TEMPLATE_DIR?>/jquery-1.7.2.min.js" type="text/javascript"></script>

<?php
// this allows to include the optional module files (frontend.css, frontend.js) into the head section
if(function_exists('register_frontend_modfiles')) {
  
register_frontend_modfiles('css');
  
register_frontend_modfiles('jquery');
  
register_frontend_modfiles('js');
?>


<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>
 
</head>

What can be wrong? Any Idea?

Offline nibz

  • Posts: 683
  • Gender: Male
Re: Problem with javascripts
« Reply #1 on: September 27, 2014, 11:17:35 PM »
Hi rumen,

Could you post or PM a link to the website.
Because that would speed up troubleshooting!

Kind regards,

Robin

Offline nibz

  • Posts: 683
  • Gender: Male
Re: Problem with javascripts
« Reply #2 on: September 27, 2014, 11:43:56 PM »
Code: [Select]
<script type="text/javascript" src="jquery-1.4.1.min.js"></script>

<?php
// this allows to include the optional module files (frontend.css, frontend.js) into the head section
if(function_exists('register_frontend_modfiles')) {
  
register_frontend_modfiles('jquery');
?>



It looks to me you are loading jQuery twice.

Offline rumen

  • Posts: 399
Re: Problem with javascripts
« Reply #3 on: September 27, 2014, 11:50:00 PM »
The site is on my localhost (xampp) so I can't give you a link. What I can do is to send you the template if this can help.

When I skip:

Code: [Select]
<!-- <script type="text/javascript" src="jquery-1.4.1.min.js"></script> -->

Nothing happens....

By the way I try to install MP3 player which works properly on other site ... nothing again it is dewplayer (very good one)

Online jacobi22

  • Posts: 5843
  • Gender: Male
  • Support also via PM or EMail
    • Jacobi22
Re: Problem with javascripts
« Reply #4 on: September 28, 2014, 01:19:43 AM »
It looks to me you are loading jQuery twice.

only twice? i count four

1.  <script type="text/javascript" src="jquery-1.4.1.min.js"></script>
2.  register_frontend_m odfiles('jquery');
3.  <script src="<?php echo TEMPLATE_DIR; ?>/jquery-1.7.2.min.js" type="text/javascript"></script>
4.  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>

use only one jquery (if you dont use libraryadmin)
change the loading order

1. your css (templates & additional css if needed)
2. the block with register_frontend_m odfiles
3. additional javascripts for modules (if not loading by modules)

Code: [Select]
<?php

if (!defined('WB_PATH')) die(header('Location: ../../index.php'));

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN" lang="EN" dir="ltr">
<head>
<title><?php page_title(); ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
if(defined('DEFAULT_CHARSET')) { echo DEFAULT_CHARSET; } else 
{ echo 
'utf-8'; }?>
" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="description" content="<?php page_description(); ?>" />
<meta name="keywords" content="<?php page_keywords(); ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo TEMPLATE_DIR?>/styles/layout.css" media="screen" />

<?php
// this allows to include the optional module files (frontend.css, frontend.js) into the head section
if(function_exists('register_frontend_modfiles')) {
  
register_frontend_modfiles('css');
  
register_frontend_modfiles('jquery');
  
register_frontend_modfiles('js');
?>

<script type="text/javascript" src="jquery.slidepanel.setup.js"></script>
<script type="text/javascript" src="jquery.cycle.min.js"></script>
<script type="text/javascript" src="jquery.cycle.setup.js"></script>
 
</head>

i use jQuery v1.11.0 and jQuery Migrate v1.2.1

Only if you use jquery 1.11.0
rename the jquery-min.js in the include/jquery-folder  to the used version in this file ( like jquery-min_183.js) and put the jQuery v1.11.0 this folder and jQuery Migrate v1.2.1 into your template folder
rename the jQuery v1.11.0.js to jquery-min.js
and call the migrate.js in a extra call like
Code: [Select]
<script src="<?php echo TEMPLATE_DIR?>/js/jQuery Migrate v1.2.1.js" type="text/javascript"></script> behind the block with register_frontend_m odfiles and before you call other js-file like jquery.slidepanel.s etup.js

if jQuery v1.11.0 doesnt work for your modules, you have only to rename the jquery-files in the include/jquery-Folder
« Last Edit: September 28, 2014, 01:25:51 AM by jacobi22 »
Wer nicht will, findet Gründe, wer will, findet Wege.

Offline rumen

  • Posts: 399
Re: Problem with javascripts
« Reply #5 on: September 28, 2014, 09:43:06 AM »
All done (I think) as described, the  jqCollapse start working properly, but the sliding panel and the player - no......

Online jacobi22

  • Posts: 5843
  • Gender: Male
  • Support also via PM or EMail
    • Jacobi22
Re: Problem with javascripts
« Reply #6 on: September 28, 2014, 01:56:41 PM »
clear the cache?
use non-browser tools like ccleaner

try other jquery versions?

do you use library admin?

is it possible to zip the mp3-player-module and post it here?
Wer nicht will, findet Gründe, wer will, findet Wege.

Offline rumen

  • Posts: 399
Re: Problem with javascripts
« Reply #7 on: September 28, 2014, 03:09:46 PM »
Sure, thanks a lot! You have the whole package on you mail.

Online jacobi22

  • Posts: 5843
  • Gender: Male
  • Support also via PM or EMail
    • Jacobi22
Re: Problem with javascripts
« Reply #8 on: September 28, 2014, 05:21:13 PM »
thx.
send an answer via mail
Wer nicht will, findet Gründe, wer will, findet Wege.