Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JavaScript]jQuery.noConflict ( Jak wykonać )
szymekszymek
post 21.04.2011, 20:28:43
Post #1





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 21.04.2011

Ostrzeżenie: (0%)
-----


Witam..

Mam Kod który gryzie sie z moim wbudowanym w forum prototype.
Na forum skryptu doradzili mi ze należy użyć formy noConflict i przepisać delikatnie źródło kodu.
Niestety nie bardzo wiem jak to wykonać.
Czy ktoś kto robił podobną operacje lub wie jak się do tego zabrać mógłby mi pomóc. ?
Był bym bardzo wdzięczny.

  1. <script src="js/cufon-yui.js" type="text/javascript"></script>
  2. <script src="js/Bebas_400.font.js" type="text/javascript"></script>
  3.  
  4. <!-- The JavaScript -->
  5. <script type="text/javascript"
  6. src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
  7. <script type="text/javascript" src="jquery.easing.1.3.js"></script>
  8. <script type="text/javascript">
  9. $(function() {
  10. //caching
  11. //next and prev buttons
  12. var $cn_next = $('#cn_next');
  13. var $cn_prev = $('#cn_prev');
  14. //wrapper of the left items
  15. var $cn_list = $('#cn_list');
  16. var $pages = $cn_list.find('.cn_page');
  17. //how many pages
  18. var cnt_pages = $pages.length;
  19. //the default page is the first one
  20. var page = 1;
  21. //list of news (left items)
  22. var $items = $cn_list.find('.cn_item');
  23. //the current item being viewed (right side)
  24. var $cn_preview = $('#cn_preview');
  25. //index of the item being viewed.
  26. //the default is the first one
  27. var current = 1;
  28.  
  29. /*
  30. for each item we store its index relative to all the document.
  31. we bind a click event that slides up or down the current item
  32. and slides up or down the clicked one.
  33. Moving up or down will depend if the clicked item is after or
  34. before the current one
  35. */
  36. $items.each(function(i){
  37. var $item = $(this);
  38. $item.data('idx',i+1);
  39.  
  40. $item.bind('click',function(){
  41. var $this = $(this);
  42. $cn_list.find('.selected').removeClass('selected');
  43. $this.addClass('selected');
  44. var idx = $(this).data('idx');
  45. var $current = $cn_preview.find('.cn_content:nth-child('+current+')');
  46. var $next = $cn_preview.find('.cn_content:nth-child('+idx+')');
  47.  
  48. if(idx > current){
  49. $current.stop().animate({'top':'-300px'},600,'easeOutBack',function(){
  50. $(this).css({'top':'310px'});
  51. });
  52. $next.css({'top':'310px'}).stop().animate({'top':'5px'},600,'easeOutBack');
  53. }
  54. else if(idx < current){
  55. $current.stop().animate({'top':'310px'},600,'easeOutBack',function(){
  56. $(this).css({'top':'310px'});
  57. });
  58. $next.css({'top':'-300px'}).stop().animate({'top':'5px'},600,'easeOutBack');
  59. }
  60. current = idx;
  61. });
  62. });
  63.  
  64. /*
  65. shows next page if exists:
  66. the next page fades in
  67. also checks if the button should get disabled
  68. */
  69. $cn_next.bind('click',function(e){
  70. var $this = $(this);
  71. $cn_prev.removeClass('disabled');
  72. ++page;
  73. if(page == cnt_pages)
  74. $this.addClass('disabled');
  75. if(page > cnt_pages){
  76. page = cnt_pages;
  77. return;
  78. }
  79. $pages.hide();
  80. $cn_list.find('.cn_page:nth-child('+page+')').fadeIn();
  81. e.preventDefault();
  82. });
  83. /*
  84. shows previous page if exists:
  85. the previous page fades in
  86. also checks if the button should get disabled
  87. */
  88. $cn_prev.bind('click',function(e){
  89. var $this = $(this);
  90. $cn_next.removeClass('disabled');
  91. --page;
  92. if(page == 1)
  93. $this.addClass('disabled');
  94. if(page < 1){
  95. page = 1;
  96. return;
  97. }
  98. $pages.hide();
  99. $cn_list.find('.cn_page:nth-child('+page+')').fadeIn();
  100. e.preventDefault();
  101. });
  102.  
  103. });
  104. </script>


Ten post edytował szymekszymek 21.04.2011, 20:30:20
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
szymekszymek
post 21.04.2011, 21:52:58
Post #2





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 21.04.2011

Ostrzeżenie: (0%)
-----


Zrobiłem tak i niestety bez efektu.. Miał byś jakiś inny pomysł ?
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 22.06.2025 - 16:55