jquery snippet code to add in php page

jquery snippet code to add in php page

Hello guys,
can you help me about jquery? I've this js:

  1. (function($, window, document, undefined) {
  2. 'use strict';

  3. var gridContainer = $('.grid-items'),
  4. filtersContainer = $('.portfolio-filters'),
  5. wrap, filtersCallback;


  6. /*********************************
  7. init cubeportfolio
  8. *********************************/
  9. gridContainer.cubeportfolio({
  10. layoutMode: 'grid',
  11. rewindNav: true,
  12. scrollByPage: false,
  13. defaultFilter: '*',
  14. animationType: gridContainer.data('animation'),
  15. gapHorizontal: gridContainer.data('gap'),
  16. gapVertical: gridContainer.data('gap'),
  17. gridAdjustment: 'responsive',
  18. mediaQueries: [{
  19. width: 1100,
  20. cols: gridContainer.data('cols')
  21. }, {
  22. width: 800,
  23. cols: gridContainer.data('cols')
  24. }, {
  25. width: 500,
  26. cols: 2
  27. }, {
  28. width: 320,
  29. cols: 1
  30. }],
  31. caption: 'zoom',
  32. displayType: 'sequentially',
  33. displayTypeSpeed: 100,

  34. // lightbox
  35. lightboxDelegate: '.cbp-lightbox',
  36. lightboxGallery: true,
  37. lightboxTitleSrc: 'data-title',
  38. lightboxCounter: '<div class="cbp-popup-lightbox-counter">{{current}} of {{total}}</div>',

  39. // singlePage popup
  40. singlePageDelegate: '.cbp-singlePage',
  41. singlePageDeeplinking: true,
  42. singlePageStickyNavigation: true,
  43. singlePageCounter: '<div class="cbp-popup-singlePage-counter">{{current}} of {{total}}</div>',
  44. singlePageCallback: function(url, element) {
  45. // to update singlePage content use the following method: this.updateSinglePage(yourContent)
  46. var t = this;

  47. $.ajax({
  48. url: url,
  49. type: 'GET',
  50. dataType: 'html',
  51. timeout: 5000
  52. })
  53. .done(function(result) {
  54. t.updateSinglePage(result);
  55. })
  56. .fail(function() {
  57. t.updateSinglePage("Error! Please refresh the page!");
  58. });
  59. },

  60. // single page inline
  61. singlePageInlineDelegate: '.cbp-singlePageInline',
  62. singlePageInlinePosition: 'above',
  63. singlePageInlineInFocus: true,
  64. singlePageInlineCallback: function(url, element) {
  65. // to update singlePage Inline content use the following method: this.updateSinglePageInline(yourContent)
  66. }
  67. });



  68. /*********************************
  69. add listener for filters
  70. *********************************/
  71. if (filtersContainer.hasClass('cbp-l-filters-dropdown')) {
  72. wrap = filtersContainer.find('.cbp-l-filters-dropdownWrap');

  73. wrap.on({
  74. 'mouseover.cbp': function() {
  75. wrap.addClass('cbp-l-filters-dropdownWrap-open');
  76. },
  77. 'mouseleave.cbp': function() {
  78. wrap.removeClass('cbp-l-filters-dropdownWrap-open');
  79. }
  80. });

  81. filtersCallback = function(me) {
  82. wrap.find('.cbp-filter-item').removeClass('cbp-filter-item-active');
  83. wrap.find('.cbp-l-filters-dropdownHeader').text(me.text());
  84. me.addClass('cbp-filter-item-active');
  85. wrap.trigger('mouseleave.cbp');
  86. };
  87. } else {
  88. filtersCallback = function(me) {
  89. me.addClass('cbp-filter-item-active').siblings().removeClass('cbp-filter-item-active');
  90. };
  91. }

  92. filtersContainer.on('click.cbp', '.cbp-filter-item', function() {
  93. var me = $(this);
  94. if (me.hasClass('cbp-filter-item-active')) {
  95. return;
  96. }

  97. // get cubeportfolio data and check if is still animating (reposition) the items.
  98. if (!$.data(gridContainer[0], 'cubeportfolio').isAnimating) {
  99. filtersCallback.call(null, me);
  100. }

  101. // filter the items
  102. gridContainer.cubeportfolio('filter', me.data('filter'), function() {});
  103. });


  104. /*********************************
  105. activate counter for filters
  106. *********************************/
  107. gridContainer.cubeportfolio('showCounter', filtersContainer.find('.cbp-filter-item'), function() {
  108. // read from url and change filter active
  109. var match = /#cbpf=(.*?)([#|?&]|$)/gi.exec(location.href),
  110. item;
  111. if (match !== null) {
  112. item = filtersContainer.find('.cbp-filter-item').filter('[data-filter="' + match[1] + '"]');
  113. if (item.length) {
  114. filtersCallback.call(null, item);
  115. }
  116. }
  117. });

  118. })(jQuery, window, document);

now i need to call  defaultFilter: '*'
in my php page by a code snippet so i can chanche dinamically the value.

I will be so glad. Thanks in advance