Commit bc2c1a08624cb6c1077dc6dc4f17b1d1468e381e

Authored by Alexey Boroda
1 parent 3093a95c

-Added some data attributes

Showing 2 changed files with 26 additions and 12 deletions   Show diff stats
frontend/views/site/index.php
... ... @@ -92,7 +92,7 @@ $moduleRequest=\Yii::$app->getModule('request_1');
92 92 </td>
93 93 </tr>
94 94 </table>
95   - <span class="modal-link" data-form="callback" ><?=\Yii::t('app','Call me!');?></span>
  95 + <span class="modal-link" data-event="call" data-form="callback" ><?=\Yii::t('app','Call me!');?></span>
96 96 </div>
97 97 </div>
98 98 </div>
... ... @@ -183,7 +183,7 @@ $moduleRequest=\Yii::$app-&gt;getModule(&#39;request_1&#39;);
183 183  
184 184 <div class="col-xs-12">
185 185 <div class="bye-link-wrapp">
186   - <span class="btn_ modal-link" data-form="buy-form">
  186 + <span class="btn_ modal-link" data-event="buy1" data-form="buy-form">
187 187 <?=\Yii::t('app','Purchase');?></span>
188 188 </div>
189 189 </div>
... ... @@ -266,7 +266,7 @@ $moduleRequest=\Yii::$app-&gt;getModule(&#39;request_1&#39;);
266 266 <div class="row">
267 267 <div class="col-xs-12 advantages-btn">
268 268 <div class="bye-link-wrapp">
269   - <span class="btn_ modal-link" data-form="buy-form"><?=\Yii::t('app','Purchase');?></span>
  269 + <span class="btn_ modal-link" data-event="buy2" data-form="buy-form"><?=\Yii::t('app','Purchase');?></span>
270 270 </div>
271 271 </div>
272 272 </div>
... ...
frontend/web/js/events.js
1 1 $(function() {
2   - $(document).on('beforeSubmit', '.section-forms #contact-form', function(e) {
3   - console.log('Form from page');
4   - });
  2 + var clicked = null;
5 3  
6   - $(document).on('submit', '#callback #contact-form', function(e) {
7   - console.log('Call me maby');
8   - });
  4 + $(document)
  5 + .on('click', '.modal-link', function() {
  6 + clicked = $(this)
  7 + .data('event');
  8 + });
  9 +
  10 + $(document)
  11 + .on('submit', '.section-forms #contact-form', function(e) {
  12 + console.log('Form from page');
  13 + });
  14 +
  15 + $(document)
  16 + .on('submit', '#callback #contact-form', function(e) {
  17 + console.log('Call me maby');
  18 + console.log(clicked);
  19 + });
  20 +
  21 + $(document)
  22 + .on('submit', '#buy-form #contact-form', function(e) {
  23 + console.log('Hello from buy form');
  24 + console.log(clicked);
  25 + });
9 26  
10   - $(document).on('submit', '#buy-form #contact-form', function(e) {
11   - console.log('Hello from buy form');
12   - });
13 27 });
14 28 \ No newline at end of file
... ...