A code execution problem

Post Reply
ashrafakader
Sr. Bludit
Posts: 40
Joined: Tue Sep 05, 2023 1:33 pm
Has thanked: 9 times

Hello,
This code is for a tabbed menu, in RTL mode. (Written in HTML, CSS & Javascript, all in a single page).
https://codepen.io/ashraf21c/pen/VwqqdYp

It works perfectly in the playground, but, sadly, it`s not the same here.
Link: https://prize-sci.org/main/autosave-cfe ... 61a5b14ff6
(I updated the link so that it be hidden from navigation menu)

I don`t know what I should do to make it compatible here.
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

Page not found. :(
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
ashrafakader
Sr. Bludit
Posts: 40
Joined: Tue Sep 05, 2023 1:33 pm
Has thanked: 9 times

User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

For me your script works on your page. What should be changed?
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
ashrafakader
Sr. Bludit
Posts: 40
Joined: Tue Sep 05, 2023 1:33 pm
Has thanked: 9 times

Kindly check this page (at the buttom)
https://codepen.io/ashraf21c/pen/VwqqdYp

The code results in horizontal and well-shaped tabs.

In bludit, it`s vertical and basic..

HTML, CSS and JS codes are in the same page.. may be Bludit requires separate files?? where to add them?
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

The codepen example and your test page have not the same CSS. For example your test page has no rules for the class tab.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
ashrafakader
Sr. Bludit
Posts: 40
Joined: Tue Sep 05, 2023 1:33 pm
Has thanked: 9 times

I see.
Many parts of the code are deleted after being added using code button in TinyMCE.
Kindly copy and paste the code in a test page in bludit.
This is my code.
(This seems to be tinymce`s problem)

Update:
I managed to replace txt file of the page using FTP. I uploaded a notepad++ version that has the same code and txt extension.
As seen now, it`s much better.. but still not perfect..
1. At the top, there`s <!DOCTYPE html>
2. Shape of tabs is very similar, but....

The code is the same, basically it`s my own code that I copy and paste.
It`s the same as the one below:

Code: Select all

<!DOCTYPE html>
<html dir="rtl">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">

<style>
* {box-sizing: border-box}
body {font-family: "Lato", sans-serif;}


/* Style the tab */
.tab {
  float: right;
  border: 1px solid #ccc;
  background-color: #f1f1f1;
  width: 30%;
  height: 300px;
}


/* Style the buttons inside the tab */
.tab button {
  display: block;
  background-color: inherit;
  color: black;
  padding: 22px 16px;
  width: 100%;
  border: none;
  outline: none;
  text-align: right;
  cursor: pointer;
  font-size: 17px;
}

/* Change background color of buttons on hover */
.tab button:hover {
  background-color: #ddd;
}

/* Create an active/current "tab button" class */
.tab button.active {
  background-color: #ccc;
}

/* Style the tab content */
.tabcontent {
  float: left;
  padding: 0px 12px;
  border: 1px solid #ccc;
  width: 70%;
  border-left: none;
  height: 300px;
  display: none;
}

/* Clear floats after the tab */
.clearfix::after {
  content: "";
  clear: both;
  display: table;
}
</style>
</head>
<body>


<h2>خدماتنا</h2>
<p>نفخر بأن نقدم لكم سلسلة من خدماتنا كما يلي أدناه:</p>

<div dir="RTL">
<div class="tab">
  <button class="tablinks" onmouseover="openService(event, 'الترجمة')">الترجمة</button>
  <button class="tablinks" onmouseover="openService(event, 'الدورات')">الدورات</button>
  <button class="tablinks" onmouseover="openService(event, 'الخدمات البحثية')">الخدمات البحثية</button>
</div>

<div id="الترجمة" class="tabcontent">
  <h3>خدمات الترجمة</h3>
  <p>نقدم خدمات الترجمة للغات التالية: العربية، اليابانية، الانجليزية، الكورية.</p>
</div>

<div id="الدورات" class="tabcontent">
  <h3>الدورات التدريبية</h3>
  <p>يسرنا تقديم دورات تدريبية متنوعة فى مجالات متعددة وفى مقرنا أو علي منصتنا التعليمية أو وفق النظام الهجين (المقر+ المنصة)</p> 
</div>

<div id="الخدمات البحثية" class="tabcontent">
  <h3>خدمات متنوعة للباحثين</h3>
  <p>.نقدم للباحثين خدمات متنوعة كما يلي أدناه وفيما لا يتعارض مع القوانين واللوائح</p>
</div>

<div class="clearfix"></div>

<script>
function openService(evt, serviceName) {
  var i, tabcontent, tablinks;
  tabcontent = document.getElementsByClassName("tabcontent");
  for (i = 0; i < tabcontent.length; i++) {
    tabcontent[i].style.display = "none";
  }
  tablinks = document.getElementsByClassName("tablinks");
  for (i = 0; i < tablinks.length; i++) {
    tablinks[i].className = tablinks[i].className.replace(" active", "");
  }
  document.getElementById(serviceName).style.display = "block";
  evt.currentTarget.className += " active";
}
</script>
   
</body>
</html> 
Post Reply