Announcement

  •  » Engine
  •  » How include jQuery and don't have conflict with jQuery from plugins?

#1 2012-05-28 19:13:51

EvilKant
Member
Russia
1970-01-01
98

How include jQuery and don't have conflict with jQuery from plugins?

I wrote jQuery script for fading all pages before open and include jQuery in "header.tpl" in template.
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
And I use "lightbox" plugin. It include jQuery too and this causes a conflict. As a result, the plugin does not work.

How I can include jQuery with piwigo functions?

Last edited by EvilKant (2012-05-28 19:14:04)

Offline

 

#2 2012-05-28 19:16:16

flop25
Piwigo Team
2006-07-06
7037

Re: How include jQuery and don't have conflict with jQuery from plugins?

Hello
http://piwigo.org/doc/doku.php?id=dev:c … own_script


edit
update link

Last edited by ddtddt (2012-05-28 19:19:41)


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#3 2012-05-28 19:16:22

ddtddt
Piwigo Team
Quetigny - France
2007-07-27
7207

Re: How include jQuery and don't have conflict with jQuery from plugins?


You love Piwigo so don't hesitate to participate, learn more on the "Contribute to Piwigo" page. If you don't have much time for contribution, you can also help the project with a donation.

Offline

 

#4 2012-05-28 19:25:32

EvilKant
Member
Russia
1970-01-01
98

Re: How include jQuery and don't have conflict with jQuery from plugins?

It did not help.

Offline

 

#5 2012-05-28 19:42:08

EvilKant
Member
Russia
1970-01-01
98

Re: How include jQuery and don't have conflict with jQuery from plugins?

thx!
{combine_script id='jquery' path='themes/default/js/jquery.min.js'} working

Offline

 

#6 2012-05-31 23:36:13

EvilKant
Member
Russia
1970-01-01
98

Re: How include jQuery and don't have conflict with jQuery from plugins?

Strange behavior of picture.tpl.
jQuery included, but my script still does not work. And it don't show {$menubar}. Rather, menubar is showing, but menubar-array is empty.

Offline

 

#7 2012-05-31 23:37:03

flop25
Piwigo Team
2006-07-06
7037

Re: How include jQuery and don't have conflict with jQuery from plugins?

post your code :)


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#8 2012-06-01 00:02:58

EvilKant
Member
Russia
1970-01-01
98

Re: How include jQuery and don't have conflict with jQuery from plugins?

header.tpl

{combine_script id='jquery' path='themes/default/js/jquery.min.js'}
<script type="text/javascript">{literal}
        $(document).ready(function() {
            $('#content_wrap').hide();
            $('#content_wrap').fadeIn(1000);
        });
        {/literal}
</script>

picture.tpl used from default template.

Div "content_wrap" starting after header in header.tpl and ending in footer.tpl. But it isnot in my script - I was test with simple "alert" function and it don't work too.

Offline

 

#9 2012-06-01 13:21:41

EvilKant
Member
Russia
1970-01-01
98

Re: How include jQuery and don't have conflict with jQuery from plugins?

Problem is solved. I combine my script too and now it is work everywhere.

Offline

 

#10 2012-06-04 20:13:00

EvilKant
Member
Russia
1970-01-01
98

Re: How include jQuery and don't have conflict with jQuery from plugins?

Script is working, but in footer I see that:

Warning: filemtime() [function.filemtime]: stat failed for ./themes/default/js/ui/minified/jquery.ui.01.min.js in F:\AppServ\www\picmun\include\template.class.php on line 1240

Offline

 

#11 2012-06-04 20:21:47

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: How include jQuery and don't have conflict with jQuery from plugins?

because this file doesn't exist, use jquery.effects.fade (it's the effect you need isn't it ?)

Offline

 

#12 2012-06-04 23:36:29

EvilKant
Member
Russia
1970-01-01
98

Re: How include jQuery and don't have conflict with jQuery from plugins?

And again...
jQuery included:

{combine_script id='jquery' load='async' path='themes/default/js/jquery.min.js'}

but... on picture.tpl jQuery don't working...

It is my last step in socialnet button creation :)

Offline

 

#13 2012-06-05 11:34:12

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: How include jQuery and don't have conflict with jQuery from plugins?

ok can you post your whole code because here it's hard

Offline

 

#14 2012-06-05 21:47:32

EvilKant
Member
Russia
1970-01-01
98

Re: How include jQuery and don't have conflict with jQuery from plugins?

header.tpl

...
{combine_script id='jquery' load='footer' path='themes/default/js/jquery.min.js'}
   
</head>

<body id="{$BODY_ID}" onLoad="vkButton('{$ROOT_URL}', '{$current.thumbnail}')">
<div class="vkBut"></div><!-- it is here just for test-->
...

footer.tpl

{combine_script id="vk_share" load='async' path="http://vkontakte.ru/js/api/share.js"}

{footer_script}{literal}
function vkButton(rootURL, imageSRC)
{       
$('.vkBut').html(VK.Share.button({
  url: document.location.href,
  title: "Picture Munchkin",
  description: "Супергероини в трико и без",
  image: rootURL+imageSRC
}));
}
       
        {/literal}
{/footer_script}

I see my button at main page, at any page, exept page with big picture(picture.tpl). I found that at this page does not work exactly jQuery. If I write something like $('.vkBut').html('bla bla bla') , this don't work too.

Last edited by EvilKant (2012-06-05 21:50:46)

Offline

 

#15 2012-06-07 12:02:51

EvilKant
Member
Russia
1970-01-01
98

Re: How include jQuery and don't have conflict with jQuery from plugins?

I found it!

At my computer I have old, but updated last version of piwigo. And jQuery didn't work on pictur.tpl.
At my notebook I have installed last version of piwigo. And all works!

At past I had problems with translations too. Updated version don't have all words in translate. I was copy it from notebook.

Offline

 
  •  » Engine
  •  » How include jQuery and don't have conflict with jQuery from plugins?

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact