Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.87 KB | None | 0 0
  1. //var site = {"ajaxurl":"http:\/\/localhost:8888\/assylum\/www\/wp-admin\/admin-ajax.php"};
  2. var site = {"ajaxurl":"http:\/\/www.ocastaneda.co\/clientes\/coffeestore\/wp-admin\/admin-ajax.php"};
  3. var jq = jQuery.noConflict();
  4. jq(document).on('ready', function(event) {
  5. console.log('inicio');
  6.  
  7.  
  8. jq('#recetas #cat').on('change',function(event) {
  9.  
  10. jq("#preloader-re").show();
  11. jq("#load-re").show();
  12.  
  13. var cat = jq('#recetas #cat option:selected').text(),
  14. post_id = jq(this).data('id'),
  15. projectTitle = jq(this).data('title'),
  16. projectSlug = jq(this).data('slug'),
  17. ajaxURL = site.ajaxurl;
  18.  
  19. jq.ajax({
  20. type: 'POST',
  21. url: ajaxURL,
  22. cache: false,
  23. context: this,
  24. data: {'action': 'load-category_content', post_id: post_id, cat: cat },
  25. success: function(response) {
  26. jq('#lista-recetas ul').html(response);
  27. return false;
  28. },
  29. complete: function(){
  30. jq("#preloader-re").delay(100).fadeOut("slow");
  31. jq("#load-re").delay(100).fadeOut("slow");
  32. }
  33. });
  34.  
  35. });
  36.  
  37.  
  38.  
  39. jq(document).on('click','a.post-link', function(e) {
  40. e.preventDefault();
  41. jq("#preloader-re-int").show();
  42. jq("#load-re-int").show();
  43. jq(this).addClass('active').removeClass('inactive').parent().siblings().find('a.post-link').addClass('inactive').removeClass('active');
  44.  
  45. var post_id = jq(this).data('id'),
  46. projectTitle = jq(this).data('title'),
  47. projectSlug = jq(this).data('slug'),
  48. ajaxURL = site.ajaxurl;
  49.  
  50. jq.ajax({
  51. type: 'POST',
  52. url: ajaxURL,
  53. cache: false,
  54. context: this,
  55. data: {'action': 'load-content', post_id: post_id },
  56. success: function(response) {
  57. jq('#project-container').html(response);
  58. return false;
  59. },
  60. complete: function(){
  61. jq("#preloader-re-int").delay(100).fadeOut("slow");
  62. jq("#load-re-int").delay(100).fadeOut("slow");
  63. }
  64. });
  65. });
  66.  
  67. new WOW().init();
  68.  
  69. function ir(ele) {
  70. var coor = ele.offset();
  71. var conv = coor.top;
  72. jq('html, body').animate({
  73. scrollTop : conv
  74. });
  75. }
  76.  
  77. if(jq('#site-navigation').length > 0){
  78. jq("a[href*='-inicio']").each(function() {
  79. var enlace = jq(this).attr('href');
  80. jq(this).on('click', function(event) {
  81. event.preventDefault();
  82.  
  83. ir(jq(enlace));
  84. window.location.hash = enlace;
  85.  
  86. });
  87. });
  88. jq('#elemento').on('click', function(){
  89. ir(jq('#elemento'));
  90. });
  91. }
  92.  
  93.  
  94.  
  95.  
  96. jq(window).load(function() {
  97. jq("#preloader").delay(100).fadeOut("slow");
  98. jq("#load").delay(100).fadeOut("slow");
  99.  
  100. var hashtag = window.location.hash;
  101.  
  102. if(hashtag){
  103. console.log(hashtag);
  104. ir(jq(hashtag));
  105. }else{
  106. console.log('nada');
  107. }
  108. });
  109.  
  110.  
  111. var links = jq('#int-productos .cont ul li').length;
  112. jq('#int-productos .cont ul li').each(function(links) {
  113. console.log(links);
  114. jq(this).on('click', function() {
  115. jq(this).addClass('active').removeClass('inactive').siblings().addClass('inactive').removeClass('active');
  116. event.preventDefault();
  117.  
  118. jq('.cont-descripcion .descripcion:eq('+links+')').addClass('animated flipInY').removeClass('zoomOutDown').show().siblings('.descripcion').removeClass('animated flipInY').addClass('zoomOutDown').hide();
  119. jq('.cont-empaque .ima-empaque:eq('+links+')').addClass('animated flipInY').removeClass('zoomOutDown').show().siblings('.ima-empaque').removeClass('animated flipInY').addClass('zoomOutDown').hide();
  120. });
  121. });
  122.  
  123. var addEvent = function(object, type, callback) {
  124. if (object === null || typeof(object) == 'undefined') return;
  125. if (object.addEventListener) {
  126. object.addEventListener(type, callback, false);
  127. } else if (object.attachEvent) {
  128. object.attachEvent("on" + type, callback);
  129. } else {
  130. object["on"+type] = callback;
  131. }
  132. };
  133. function cambiar(){
  134. var responsive_viewport = jq(window).width();
  135.  
  136. if (responsive_viewport > 480) {
  137.  
  138. }
  139. if (responsive_viewport < 800) {
  140. // cambio de orden noticias
  141. if(jq('.wrap-noticias').length > 0){
  142. jq('.wrap-noticias').each(function(index, el) {
  143. var text = jq(this).find('.info-tit');
  144. jq(this).find('.imagen-noticia').insertAfter(text);
  145. });
  146. }
  147. // cambio de orden noticias
  148. if(jq('.wrap-promociones').length > 0){
  149. jq('.wrap-promociones').each(function(index, el) {
  150. var text = jq(this).find('.info-tit');
  151. jq(this).find('.imagen-promociones').insertAfter(text);
  152. });
  153. }
  154. /*cambio orden productos */
  155. if(jq('.wrap-prod').length > 0){
  156. jq('.wrap-prod').each(function(index, el) {
  157. var text = jq(this).find('.cabezote-prod');
  158. jq(this).find('.cont-descripcion').insertAfter(text);
  159. });
  160. }
  161. if(jq('.wrap-prod').length > 0){
  162. jq('.wrap-prod').each(function(index, el) {
  163. var text = jq(this).find('.cont-prod');
  164. jq(this).find('.ima-prod').insertAfter(text);
  165. });
  166. }
  167.  
  168. }
  169. if (responsive_viewport > 800) {
  170. if(jq('.wrap-prod').length > 0){
  171. jq('.wrap-prod:odd').each(function(index, el) {
  172. var text = jq(this).find('.cont-prod');
  173. jq(this).find('.ima-prod').insertAfter(text);
  174. });
  175. jq('.wrap-prod:even').each(function(index, el) {
  176. var text = jq(this).find('.cont-prod');
  177. jq(this).find('.ima-prod').insertBefore(text);
  178. });
  179. }
  180. jq('#masthead').affix({
  181. offset: {
  182. top: 100,
  183. bottom: function () {
  184. return (this.bottom = jq('.footer').outerHeight(true));
  185. }
  186. }
  187. });
  188.  
  189. }
  190. if (responsive_viewport > 992) {
  191. if(jq('.wrap-noticias').length > 0){
  192. jq('.wrap-noticias').each(function(index, el) {
  193. var text = jq(this);
  194. jq(this).find('.imagen-noticia').appendTo(text);
  195. });
  196. }
  197. // cambio de orden noticias
  198. if(jq('.wrap-promociones').length > 0){
  199. jq('.wrap-promociones').each(function(index, el) {
  200. var text = jq(this);
  201. jq(this).find('.imagen-promociones').prependTo(text);
  202. });
  203. }
  204. /*cambio orden productos */
  205. if(jq('.wrap-prod').length > 0){
  206. jq('.wrap-prod').each(function(index, el) {
  207. var text = jq(this).find('.cont-empaque');
  208. jq(this).find('.cont-descripcion').insertAfter(text);
  209. });
  210. }
  211. }
  212. }
  213.  
  214. cambiar();
  215.  
  216. addEvent(window, "resize", function(){
  217. cambiar();
  218. });
  219.  
  220. //Enable swiping...
  221. jq(".carousel-inner").swipe( {
  222. //Generic swipe handler for all directions
  223. swipeLeft:function(event, direction, distance, duration, fingerCount) {
  224. jq(this).parent().carousel('next');
  225. },
  226. swipeRight: function() {
  227. jq(this).parent().carousel('prev');
  228. }
  229. });
  230.  
  231. jq('#nosotros-inicio article section').readmore({
  232. speed: 75,
  233. embedCSS: false,
  234. collapsedHeight: 255,
  235. heightMargin: 50,
  236. moreLink: '<div class="row vermas"><div class="col-md-12"><a class="btn" href="#"><span data-hover="Conoce más">Conoce más</span></a></div></div>',
  237. lessLink: '<div class="row vermas"><div class="col-md-12"><a class="btn" href="#"><span data-hover="Conoce menos">Conoce menos</span></a></div></div>'
  238. });
  239.  
  240.  
  241. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement