Post by nordicmood » Mon May 21, 2018 9:03 pm

Hi,

Im trying to create a "read more" button to my website. The code Im using on my Opencart 2 version works fine, the only thing is that every time I press the read more button and then refresh the page, the read more button has disappeared. If I then go into the CMS editor and just save the CMS block, then the read more button is activated again. With other words, the read more button works one time, then I have to go into CMS editor and just press save to reactivate it… Can anyone tell me how I can sort this issue out? Ps. I dont know much about coding (with text displayed below)...

I'm using the following code:

<h1>NORDIC MOOD INTERIORS</h1>

<div class="comment more">Minimalism and simplicity through functional designs in Nordic style, creating elegant and inspiring Scandinavian furniture and home d&eacute;cor.<br />
<br />
Nordic Mood Interior&rsquo;s collection is comprised of excellent craftsmanship and timeless design, offering Nordic furnishings and accessories that capture the essence of minimalist Scandinavian style.All our Scandinavian designs are produced using only the finest materials, focusing on high quality while producing ethical and environmentally friendly Nordic home d&eacute;cor and accessories.
<h3>Scandinavian Furniture From Nordic Mood Interiors</h3>

<p>Nordic Mood Interiors offer Scandinavian Furniture and Nordic home accessories carefully sourced from trusted and high-quality designers and manufacturers to create Nordic Interior design across the UK. We are also pleased to offer our own small collection of products, designed in house, to compliment and reflect the same Nordic essence of interior design as our suppliers.</p>

<p>Nordic Mood Interiors&rsquo; emphasis on function and form reflects the Koselig style of a traditional Scandinavian home infused with modernism and calming simplicity.</p>

<h4>Nordic Inspiration With Practical And Decorative Scandinavian Home Furniture Design.</h4>

<p>Using strong organic shapes, clean lines, and tactile materials, our Scandi style furniture and Nordic home accessories are both ergonomically and aesthetically pleasing.</p>

<p>Designed and produced with the highest quality in mind, our Scandinavian home d&eacute;cor reflects the quality of design as where it finds its roots, aiding both comfort and emotional well-being.</p>

<h5>What Is Scandinavian Design?</h5>

<p>The Scandinavian countries of the North are well-known for their dense forested mountains and cold, snow-covered landscapes for long months of the year.</p>

<p>It&rsquo;s because of these long dark months that Scandinavian homes required the psychological warmth and domesticity which is now embedded in Scandinavian design. Through organic form, textures and patterns, in objects such as beds, throws, and pillows, human qualities of warmth are present.</p>

<p>A lesser-known prevailing ethos Scandinavian furniture is its role of social inclusivity and tolerance which permeates Scandinavian furniture design</p>

<h6>The Essence of Scandi Living</h6>

<p>Nordic Home Interiors is a celebration of style of Nordic inspiration. Switching off isn&rsquo;t always easy in the modern world but Nordic Home Interiors helps you to capture the essence of the Scandinavian lifestyle.</p>

<p>The Danish Hygge</p>

<p>&lsquo;Hygge&rsquo; (pronounced &lsquo;hoo-gah&rsquo;) is a Danish concept, and one that resonates through the idea behind Scandinavian interior design.</p>

<h3>How To Create The Scandi look?</h3>

<p>For years interior design and architecture has been influenced by other cultures and countries, and Scandinavian design is quickly becoming the prevalent interior design of choice for the modern home.</p>

<h4>Scandinavian Garden Design</h4>

<p>The essence of Scandinavian living doesn&rsquo;t have to end with your interiors. Enjoy the benefits of connecting with nature by creating relaxing spaces for you and your family outdoors. Our Scandinavian garden furniture lets you use textiles and soft furnishings to make your outside spaces as comfortable and as inviting as your interiors, so that you can enjoy the benefits of Nordic style alfresco living and nature&rsquo;s calming fresh air. Neutral tones paired with contemporary designs in soft woven materials create environmentally friendly furnishings to help you unlock the beauty of your surroundings</p>
</div>

Newbie

Posts

Joined
Fri Jul 07, 2017 4:51 pm

Post by yodapt » Mon May 21, 2018 10:04 pm

Journal?

Opencart Developer - My Extension Showcase
Contact me at aeon.yoda@gmail.com


User avatar
Active Member

Posts

Joined
Fri Jun 17, 2011 6:39 pm


Post by theGeekyStuff » Thu May 24, 2018 6:14 pm

You will want to add a tag to the hidden paragraph within the read more button. In your HTML content, you can do the following i.e,

Code: Select all

<span id="moretext">Ceteros comprehensam est ut, mel deserunt temporibus interpretaris ad. Primis liberavisse et nam, justo graece causae id ius. Ne tollit audiam vel, sumo euismod suavitate et per. No noster similique mei. Falli persecuti ei nam. </span>
Then, add display property for the tag in your css file i.e,

Code: Select all

#moretext{
display:none;
}
Lastly, add your javascript "read more" button. You can add this inline to your HTML content as source code provided your editor has codemirror plugin or similar.

Code: Select all

<script type="application/javascript">
$(document).ready(function() {
  $("#toggle").click(function() {
    var elem = $("#toggle").text();
    if (elem == "Read More") {
      $("#toggle").text("Read Less");
      $("#moretext").slideDown();
    } else {
      $("#toggle").text("Read More");
      $("#moretext").slideUp();
    }
  });
});
</script>

Newbie

Posts

Joined
Wed May 23, 2018 7:08 pm

Post by nordicmood » Thu May 24, 2018 7:28 pm

Thanks for that! I'll check it out...

It's Journal, yes.

Newbie

Posts

Joined
Fri Jul 07, 2017 4:51 pm

Post by theGeekyStuff » Thu May 24, 2018 8:09 pm

If Journal, you can simply add the CSS code in Settings > Custom Code > CCS

Newbie

Posts

Joined
Wed May 23, 2018 7:08 pm
Who is online

Users browsing this forum: No registered users and 24 guests